{"id":334594,"date":"2022-06-16T15:02:54","date_gmt":"2022-06-16T15:02:54","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=334594"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=334594","title":{"rendered":"<span>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 GPCS4, \u0438\u043b\u0438 \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0432 \u00abBloodborne\u00bb \u043d\u0430 PC<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u042d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u2013 \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439. \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f GPCS4, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0433\u0440 \u0434\u043b\u044f PS4 \u043d\u0430 PC. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 GPCS4, \u0438 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 PVS-Studio \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/839\/0bb\/7f8\/8390bb7f8263cad1c878af188dc99d4b.png\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/839\/0bb\/7f8\/8390bb7f8263cad1c878af188dc99d4b.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041e \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/h3>\n<p>GPCS4 \u2013 \u044d\u0442\u043e \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 PlayStation 4, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 C \u0438 C++.<\/p>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0446\u0435\u043b\u044c\u044e \u0430\u0432\u0442\u043e\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u044b\u043b\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 PS4. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u0441\u044f, \u0438 \u0443\u0436\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 2020 \u0433\u043e\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c GPCS4 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0438\u0433\u0440\u0443 <a href=\"https:\/\/habr.com\/ru\/news\/t\/487050\/\" rel=\"noopener noreferrer nofollow\">We are Doomed<\/a>. \u042d\u0442\u043e \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u044b\u0439 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430 PC \u0438\u0433\u0440\u044b \u0434\u043b\u044f PS4. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u0430\u043c \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u0431\u044b\u043b \u0434\u0430\u043b\u0451\u043a \u043e\u0442 \u0438\u0434\u0435\u0430\u043b\u0430: \u0438\u0433\u0440\u0430 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0434\u0451\u0440\u0433\u0430\u043b\u0430\u0441\u044c. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, <a href=\"https:\/\/github.com\/Inori\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a> \u043f\u043e\u043b\u043e\u043d \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0437\u043c\u0430 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0430\u043f\u0440\u0435\u043b\u044f 2022 \u0433\u043e\u0434\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0441\u044f <a href=\"https:\/\/github.com\/Inori\/GPCS4\/releases\/tag\/v0.1.0\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 GPCS4<\/a>. \u042f \u0441\u043a\u0430\u0447\u0430\u043b \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u0432\u0435\u0440\u0441\u0438\u044e 0.1.0 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041a \u0441\u043b\u043e\u0432\u0443, \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0443\u0436\u0435 \u0432\u044b\u0448\u0435\u043b \u0440\u0435\u043b\u0438\u0437 0.2.0 \u2013 \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0438 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443 PVS-Studio \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 GPCS4.<\/p>\n<h3>\u041f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u044b\u0439 break<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v794\" rel=\"noopener noreferrer nofollow\">V796<\/a> [CWE-484] It is possible that &#8216;break&#8217; statement is missing in switch statement. AudioOut.cpp 137<\/p>\n<pre><code class=\"cpp\">static AudioProperties getAudioProperties(uint32_t param) {   uint32_t format       = param &amp; 0x000000ff;   AudioProperties props = {};    switch (format)   {     \/\/ ....     case SCE_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD:     {       props.nChannels   = 8;       props.bytesPerSample  = 2;       props.audioFormat = RTAUDIO_FORMAT_SINT16;       break;     }     case SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO:     {       props.nChannels   = 1;       props.bytesPerSample  = 4;       props.audioFormat = RTAUDIO_FORMAT_FLOAT32;         \/\/ &lt;=     }     case SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_STEREO:     {       props.nChannels   = 2;       props.bytesPerSample  = 4;       props.audioFormat = RTAUDIO_FORMAT_FLOAT32;       break;     }   }   return props; } <\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f <em>SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO<\/em> \u043f\u043e\u0442\u0435\u0440\u044f\u043d <em>break<\/em>. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.<\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v595\/\" rel=\"noopener noreferrer nofollow\">V595<\/a> The &#8216;m_moduleData&#8217; pointer was utilized before it was verified against nullptr. Check lines: 49, 53. ELFMapper.cpp 49<\/p>\n<pre><code class=\"cpp\">struct NativeModule { \/*....*\/ };  class ELFMapper {   \/\/ ....   NativeModule *m_moduleData; };  bool ELFMapper::validateHeader() {   bool retVal      = false;   auto &amp;fileMemory = m_moduleData->m_fileMemory;   do   {     if (m_moduleData == nullptr)     {       LOG_ERR(\"file has not been loaded\");       break;     }     \/\/ ....   } while (false);      return retVal; } <\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>m_moduleData<\/em> \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 <em>do-while<\/em> \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 <em>nullptr<\/em>.<\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442\u044c: &#171;\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430 \u0432\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c? \u0410 \u043f\u043e\u0442\u043e\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 <em>do-while<\/em> \u044d\u0442\u043e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c? \u0422\u043e\u0433\u0434\u0430 \u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0443\u0442 \u043d\u0435\u0442&#187;. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0438\u0437-\u0437\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f <em>while (false)<\/em> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0446\u0438\u043a\u043b\u0430. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>m_moduleData<\/em> <a href=\"https:\/\/github.com\/Inori\/GPCS4\/blob\/67442ae29df1916137a01b87b675375d8b48be0e\/GPCS4\/Loader\/ELFMapper.cpp#L45-L88\" rel=\"noopener noreferrer nofollow\">\u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/a>.<\/p>\n<p>\u0414\u0440\u0443\u0433\u043e\u0435 \u0432\u043e\u0437\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0437\u044f\u0442\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u2013 \u044d\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u0412\u0435\u0434\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u0431\u0443\u0434\u0435\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439. \u041d\u043e \u043d\u0435\u0442, \u0442\u0430\u043a\u043e\u0439 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0306\/\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a>. \u042d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0434\u043e \u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">bool ELFMapper::validateHeader() {   bool retVal      = false;      do   {     if (m_moduleData == nullptr)     {       LOG_ERR(\"file has not been loaded\");       break;     }      auto &amp;fileMemory = m_moduleData->m_fileMemory;     \/\/ ....   } while (false);    return retVal; } <\/code><\/pre>\n<h3>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v519\/\" rel=\"noopener noreferrer nofollow\">V519<\/a> [CWE-563] The &#8216;* memoryType&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 54, 55. sce_kernel_memory.cpp 55<\/p>\n<pre><code class=\"cpp\">int PS4API sceKernelGetDirectMemoryType(sce_off_t start, int *memoryType,      sce_off_t *regionStartOut, sce_off_t *regionEndOut) {   LOG_SCE_DUMMY_IMPL();   *memoryType = SCE_KERNEL_WB_GARLIC;   *memoryType = SCE_KERNEL_WC_GARLIC;   return SCE_OK; } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e <em>LOG_SCE_DUMMY_IMPL<\/em>, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <em>sceKernelGetDirectMemoryType<\/em> \u0435\u0449\u0451 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f. \u0418 \u0432\u0441\u0451 \u0436\u0435, \u0434\u0432\u0430 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u0430\u0434\u0440\u0435\u0441\u0443 <em>memoryType<\/em> \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v512\/\" rel=\"noopener noreferrer nofollow\">V512<\/a> [CWE-119] A call of the &#8216;memset&#8217; function will lead to overflow of the buffer &#8216;param->reserved&#8217;. sce_gnm_draw.cpp 420<\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v531\/\" rel=\"noopener noreferrer nofollow\">V531<\/a> [CWE-131] It is odd that a sizeof() operator is multiplied by sizeof(). sce_gnm_draw.cpp 420<\/p>\n<pre><code class=\"cpp\">struct GnmCmdPSShader {   uint32_t              opcode;   gcn::PsStageRegisters psRegs;   uint32_t              reserved[27]; };  int PS4API sceGnmSetPsShader350(uint32_t* cmdBuffer, uint32_t numDwords,                                  const gcn::PsStageRegisters *psRegs) {   \/\/ ....   memset(param->reserved, 0, sizeof(param->reserved) * sizeof(uint32_t));    return SCE_OK; } <\/code><\/pre>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u043e\u0434\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a PVS-Studio. \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>memset<\/em> \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0442\u044c\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c. \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>sizeof(param->reserved)<\/em> \u0443\u0436\u0435 \u0432\u0435\u0440\u043d\u0451\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>param->reserved<\/em>. \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 <em>sizeof(uint32_t)<\/em> \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 4 \u0440\u0430\u0437\u0430, \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <em>memset<\/em> \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>param->reserved<\/em>. \u041d\u0443\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cpp\">int PS4API sceGnmSetPsShader350( \/*....*\/ ) {   \/\/ ....   memset(param->reserved, 0, sizeof(param->reserved));   return SCE_OK; } <\/code><\/pre>\n<p>\u0412\u0441\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b 20 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v512\/\" rel=\"noopener noreferrer nofollow\">V512<\/a> [CWE-119] A call of the &#8216;memset&#8217; function will lead to overflow of the buffer &#8216;initParam->reserved&#8217;. sce_gnm_dispatch.cpp 16<\/p>\n<pre><code class=\"cpp\">uint32_t PS4API sceGnmDispatchInitDefaultHardwareState(uint32_t* cmdBuffer,                                                        uint32_t numDwords) {   \/\/ ....   memset(initParam->reserved, 0,          sizeof(initParam->reserved) * sizeof(uint32_t));   return initCmdSize; } <\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>initParam->reserved<\/em>.<\/p>\n<h3>\u0423\u0447\u0438\u043c\u0441\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e \u0441\u0435\u043c\u0438, \u0438\u043b\u0438 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v557\/\" rel=\"noopener noreferrer nofollow\">V557<\/a> [CWE-787] Array overrun is possible. The &#8216;dynamicStateCount ++&#8217; index is pointing beyond array bound. VltGraphics.cpp 157<\/p>\n<pre><code class=\"cpp\">VkPipeline VltGraphicsPipeline::createPipeline(\/* .... *\/) const {   \/\/ ....   std::array&lt;VkDynamicState, 6> dynamicStates;   uint32_t                      dynamicStateCount = 0;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR;   if (state.useDynamicDepthBias())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BIAS;   if (state.useDynamicDepthBounds())   {     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS;     dynamicStates[dynamicStateCount++] =                              VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE;   }   if (state.useDynamicBlendConstants())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_BLEND_CONSTANTS;   if (state.useDynamicStencilRef())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE;   \/\/ .... } <\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>dynamicStates<\/em>. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0435\u0441\u0442\u044c 4 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>if (state.useDynamicDepthBias())<\/p>\n<\/li>\n<li>\n<p>if (state.useDynamicDepthBounds())<\/p>\n<\/li>\n<li>\n<p>if (state.useDynamicBlendConstants())<\/p>\n<\/li>\n<li>\n<p>if (state.useDynamicStencilRef())<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0444\u043b\u0430\u0433\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>if (state.useDynamicDepthBias())<\/em>:<\/p>\n<pre><code class=\"cpp\">bool useDynamicDepthBias() const {   return rs.depthBiasEnable(); }  VkBool32 depthBiasEnable() const {   return VkBool32(m_depthBiasEnable); } <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0432\u0441\u0435 \u044d\u0442\u0438 4 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u043c\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0422\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f 7 \u0441\u0442\u0440\u043e\u043a \u0432\u0438\u0434\u0430 <em>&#8216;dynamicStates[dynamicStateCount++] = &#8230;.&#8217;<\/em>. \u041d\u0430 \u0441\u0435\u0434\u044c\u043c\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a <em>dynamicStates[6]<\/em>. \u042d\u0442\u043e \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 7 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">VkPipeline VltGraphicsPipeline::createPipeline(\/* .... *\/) const {   \/\/ ....   std::array&lt;VkDynamicState, 7> dynamicStates; \/\/ &lt;=   uint32_t                      dynamicStateCount = 0;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR;   if (state.useDynamicDepthBias())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BIAS;   if (state.useDynamicDepthBounds())   {     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS;     dynamicStates[dynamicStateCount++] =                              VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE;   }   if (state.useDynamicBlendConstants())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_BLEND_CONSTANTS;   if (state.useDynamicStencilRef())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE;   \/\/ .... } <\/code><\/pre>\n<h3>\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v547\/\" rel=\"noopener noreferrer nofollow\">V547<\/a> [CWE-570] Expression &#8216;nOldFlag &amp; VMPF_NOACCESS&#8217; is always false. PlatMemory.cpp 22<\/p>\n<pre><code class=\"cpp\">#define PAGE_NOACCESS           0x01 #define PAGE_READONLY           0x02 #define PAGE_READWRITE          0x04 #define PAGE_EXECUTE            0x10 #define PAGE_EXECUTE_READ       0x20 #define PAGE_EXECUTE_READWRITE  0x40  enum VM_PROTECT_FLAG {   VMPF_NOACCESS  = 0x00000000,   VMPF_CPU_READ  = 0x00000001,   VMPF_CPU_WRITE = 0x00000002,   VMPF_CPU_EXEC  = 0x00000004,   VMPF_CPU_RW    = VMPF_CPU_READ | VMPF_CPU_WRITE,   VMPF_CPU_RWX   = VMPF_CPU_READ | VMPF_CPU_WRITE | VMPF_CPU_EXEC, };  inline uint32_t GetProtectFlag(VM_PROTECT_FLAG nOldFlag) {   uint32_t nNewFlag = 0;   do   {     if (nOldFlag &amp; VMPF_NOACCESS)     {       nNewFlag = PAGE_NOACCESS;       break;     }      if (nOldFlag &amp; VMPF_CPU_READ)     {       nNewFlag = PAGE_READONLY;     }      if (nOldFlag &amp; VMPF_CPU_WRITE)     {       nNewFlag = PAGE_READWRITE;     }      if (nOldFlag &amp; VMPF_CPU_EXEC)     {       nNewFlag = PAGE_EXECUTE_READWRITE;     }    } while (false);   return nNewFlag; } <\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <em>GetProtectFlag<\/em> \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0444\u043b\u0430\u0433 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0443 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0435 \u0443\u0447\u0451\u043b, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>VMPF_NOACCESS<\/em> \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <em>if (nOldFlag &amp; VMPF_NOACCESS)<\/em> \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u043e\u0436\u043d\u043e\u0435 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0435\u0440\u043d\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>PAGE_NOACCESS<\/em>.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>GetProtectFlag<\/em> \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u043b\u0430\u0433 <em>VMPF_NOACCESS<\/em>, \u043d\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u043b\u0430\u0433 <em>VMPF_CPU_EXEC<\/em> \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432\u043e \u0444\u043b\u0430\u0433 <em>PAGE_EXECUTE_READWRITE<\/em>.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043f\u0435\u0440\u0432\u043e\u0439 \u043c\u044b\u0441\u043b\u044c\u044e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0440\u043e\u0434\u0435:<\/p>\n<pre><code class=\"cpp\">inline uint32_t GetProtectFlag(VM_PROTECT_FLAG nOldFlag) {   uint32_t nNewFlag = PAGE_NOACCESS;   if (nOldFlag &amp; VMPF_CPU_READ)   {     nNewFlag |= PAGE_READ;   }    if (nOldFlag &amp; VMPF_CPU_WRITE)   {     nNewFlag |= PAGE_WRITE;   }    if (nOldFlag &amp; VMPF_CPU_EXEC)   {     nNewFlag |= PAGE_EXECUTE;   }    return nNewFlag; } <\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <em>PAGE_NOACCESS<\/em>, <em>PAGE_READONLY<\/em> \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u2013 \u044d\u0442\u043e Windows-\u0444\u043b\u0430\u0433\u0438 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u043e\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 \u043d\u0435\u0442 \u0444\u043b\u0430\u0433\u0430 <em>PAGE_WRITE<\/em>. \u0421\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, \u0442\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u0435\u0449\u0435 \u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435. \u041f\u043e \u0442\u0435\u043c \u0436\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u043d\u0435\u0442 \u0444\u043b\u0430\u0433\u0430 <em>PAGE_EXECUTE_WRITE<\/em>.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u0418\u041b\u0418&#187; \u0434\u0432\u0443\u0445 Windows-\u0444\u043b\u0430\u0433\u043e\u0432 \u043d\u0435 \u0434\u0430\u0451\u0442 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0444\u043b\u0430\u0433, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0443\u043c\u043c\u0435 \u043f\u0440\u0430\u0432: <em>PAGE_READONLY | PAGE_EXECUTE != PAGE_EXECUTE_READ<\/em>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">inline uint32_t GetProtectFlag(VM_PROTECT_FLAG nOldFlag) {   switch (nOldFlag)   {     case VMPF_NOACCESS:       return PAGE_NOACCESS;     case VMPF_CPU_READ:       return PAGE_READONLY;     case VMPF_CPU_WRITE: \/\/ same as ReadWrite     case VMPF_CPU_RW:       return PAGE_READWRITE;     case VMPF_CPU_EXEC:       return PAGE_EXECUTE;     case VMPF_CPU_READ | VMPF_CPU_EXEC:       return PAGE_EXECUTE_READ:     case VMPF_CPU_WRITE | VMPF_CPU_EXEC: \/\/ same as ExecuteReadWrite     case VMPF_CPU_RWX:       return PAGE_EXECUTE_READWRITE;     default:       LOG(\"unknown PS4 flag\");       return PAGE_NOACCESS;   } } <\/code><\/pre>\n<h3>\u041b\u0438\u0448\u043d\u044f\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v547\/\" rel=\"noopener noreferrer nofollow\">V547<\/a> [CWE-571] Expression &#8216;retAddress&#8217; is always true. Memory.cpp 373<\/p>\n<pre><code class=\"cpp\">void* MemoryAllocator::allocateInternal(void* addrIn, size_t len,                                         size_t alignment, int prot) {   \/\/ ....   while (searchAddr &lt; SCE_KERNEL_APP_MAP_AREA_END_ADDR)     {       \/\/ ....       void* retAddress = VMAllocate(reinterpret_cast&lt;void*>(regionAddress), len,                                     plat::VMAT_RESERVE_COMMIT, uprot);       if (!retAddress)       {         searchAddr = reinterpret_cast&lt;size_t>(mi.pRegionStart) + mi.nRegionSize;         continue;       }       \/\/ ....       if (retAddress)       {         \/\/ unlikely         plat::VMFree(retAddress);       }     \/\/ ....     }   \/\/ .... } <\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>retAddress<\/em> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u0432\u0430\u0436\u0434\u044b. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>if (!retAddress)<\/em>. \u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0443\u043b\u0435\u0432\u043e\u0439, \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 <em>while<\/em>. \u0418\u043d\u0430\u0447\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>retAddress<\/em> \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>if (retAddress)<\/em> \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u0430\u044f, \u0438 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c.<\/p>\n<h3>\u0415\u0449\u0451 \u043e\u0434\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v547\/\" rel=\"noopener noreferrer nofollow\">V547<\/a> [CWE-571] Expression &#8216;pipeConfig == kPipeConfigP16&#8217; is always true. GnmDepthRenderTarget.h 170<\/p>\n<pre><code class=\"cpp\">uint8_t getZReadTileSwizzleMask(void) const     {       \/\/ From IDA       auto pipeConfig = getPipeConfig();       auto zfmt       = getZFormat();       auto tileMode   = getTileMode();       if (pipeConfig != kPipeConfigP16 ||     \/\/ &lt;=         zfmt == kZFormatInvalid ||         !GpuAddress::isMacroTiled(tileMode))       {         return 0;       }        auto     dataFormat          = DataFormat::build(zfmt);       auto     totalBitsPerElement = dataFormat.getTotalBitsPerElement();       uint32_t numFragments          = 1 &lt;&lt; getNumFragments();       uint32_t shift               = 0;       NumBanks numBanks            = {};       if (pipeConfig == kPipeConfigP16)      \/\/ &lt;=       {         GpuAddress::getAltNumBanks(&amp;numBanks, tileMode,                                    totalBitsPerElement, numFragments);         shift = 4;       }       else       {         GpuAddress::getNumBanks(&amp;numBanks, tileMode,                                 totalBitsPerElement, numFragments);         shift = 3;       }        return (this->m_regs[2] &amp; (((1 &lt;&lt; (numBanks + 1)) - 1) &lt;&lt; shift)) >> 4;     } <\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0430\u0448\u0451\u043b \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <em>if (pipeConfig == kPipeConfigP16)<\/em>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0442\u0430\u043a.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>getPipeConfig<\/em> \u0432\u0435\u0440\u043d\u0443\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0435 \u0440\u0430\u0432\u043d\u043e\u0435 <em>kPipeConfigP16<\/em>, \u0442\u043e \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0440\u043d\u044b\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 <em>if (pipeConfig == kPipeConfigP16)<\/em>.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u044d\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043b\u0438\u0431\u043e \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043b\u0438\u0431\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u0430. \u041d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u043f\u0435\u0448\u0438\u0442\u044c \u0438 \u0443\u0431\u0438\u0440\u0430\u0442\u044c \u0435\u0451. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0443\u0431\u0440\u0430\u043d\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<h3>\u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u044b<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v517\/\" rel=\"noopener noreferrer nofollow\">V517<\/a> [CWE-570] The use of &#8216;if (A) {&#8230;} else if (A) {&#8230;}&#8217; pattern was detected. There is a probability of logical error presence. Check lines: 469, 475. GnmGpuAddress.cpp 469<\/p>\n<pre><code class=\"cpp\">int32_t sce::GpuAddress::adjustTileMode(\/* .... *\/) { switch(microTileMode) {   case Gnm::kMicroTileModeThin:     if      (newArrayMode == Gnm::kArrayMode3dTiledThick)       *outTileMode = Gnm::kTileModeThick_3dThick;     else if      (newArrayMode == Gnm::kArrayMode2dTiledThick)       *outTileMode = Gnm::kTileModeThick_2dThick;     else if (newArrayMode == Gnm::kArrayMode1dTiledThick)       *outTileMode = Gnm::kTileModeThick_1dThick;     else if (newArrayMode == Gnm::kArrayMode3dTiledThin)       *outTileMode = Gnm::kTileModeThin_3dThin; \/\/ ....     else if (newArrayMode == Gnm::kArrayMode3dTiledThinPrt)       *outTileMode = Gnm::kTileModeThin_3dThinPrt; \/\/ ....     else if (newArrayMode == Gnm::kArrayMode2dTiledThin)                  \/\/ &lt;=       *outTileMode = Gnm::kTileModeThin_2dThin; \/\/ ....     else if (newArrayMode == Gnm::kArrayMode2dTiledThinPrt)       *outTileMode = Gnm::kTileModeThin_2dThinPrt; \/\/ ....     else if (newArrayMode == Gnm::kArrayModeTiledThinPrt)       *outTileMode = Gnm::kTileModeThin_ThinPrt; \/\/ ....     else if (newArrayMode == Gnm::kArrayMode2dTiledThin)                  \/\/ &lt;=       *outTileMode = Gnm::kTileModeThin_2dThin;     else if (newArrayMode == Gnm::kArrayMode1dTiledThin)       *outTileMode = Gnm::kTileModeThin_1dThin;     else       break;     return kStatusSuccess;   \/\/ .... } } <\/code><\/pre>\n<p>\u041d\u0435 \u043e\u0431\u043e\u0448\u043b\u043e\u0441\u044c \u0438 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u044b. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0434\u0432\u0430\u0436\u0434\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>newArrayMode == Gnm::kArrayMode2dTiledThin<\/em>.<\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u043e\u0439. \u0410 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043e\u043d\u0430 \u043b\u0438\u0448\u043d\u044f\u044f, \u0438 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439?<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v732\/\" rel=\"noopener noreferrer nofollow\">V732<\/a> [CWE-480] Unary minus operator does not modify a bool type value. Consider using the &#8216;!&#8217; operator. GnmRenderTarget.h 237<\/p>\n<pre><code class=\"cpp\">typedef enum RenderTargetChannelType {   kRenderTargetChannelTypeUNorm            = 0x00000000,   kRenderTargetChannelTypeSNorm            = 0x00000001,   kRenderTargetChannelTypeUInt             = 0x00000004,   kRenderTargetChannelTypeSInt             = 0x00000005,   kRenderTargetChannelTypeSrgb             = 0x00000006,   kRenderTargetChannelTypeFloat            = 0x00000007, } RenderTargetChannelType;  void setDataFormat(DataFormat format) {   \/\/ ....   int v3;   RenderTargetChannelType  type;  \/\/ [rsp+4h] [rbp-3Ch]   __int64                  v9;  \/\/ [rsp+10h] [rbp-30h]   bool typeConvertable = format.getRenderTargetChannelType(&amp;type);   v2 = type | kRenderTargetChannelTypeSNorm;   v3  = (uint8_t) - (type &lt; 7) &amp; (uint8_t)(0x43u >> type) &amp; 1; \/\/ &lt;=   \/\/ .... } <\/code><\/pre>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043e\u0436\u0438\u0434\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043f\u0443\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>type<\/em> \u043c\u0435\u043d\u044c\u0448\u0435 <em>7<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>type &lt; 7<\/em> \u0440\u0430\u0432\u043d\u043e <em>true<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0442\u0435\u043c \u043a <em>true<\/em> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u043d\u0430\u0440\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <em>-1<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>-1<\/em> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a <em>unsigned char<\/em>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <em>0b1111&#8217;1111<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>\u043f\u0443\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>type<\/em> \u043c\u0435\u043d\u044c\u0448\u0435 <em>7<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>type &lt; 7<\/em> \u0440\u0430\u0432\u043d\u043e <em>true<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0442\u0435\u043c \u043a <em>true<\/em> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u043d\u0430\u0440\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <em>1<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>1<\/em> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a <em>unsigned char<\/em>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <em>0b0000&#8217;0001<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <em>&amp; 1<\/em> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443. \u041f\u043e \u044d\u0442\u043e\u0439 \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0434 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>v3<\/em> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>type<\/em>.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439: \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>type<\/em> \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 7.<\/p>\n<ul>\n<li>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>type &lt; 7<\/em> \u0440\u0430\u0432\u043d\u043e <em>false<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u041a <em>false<\/em> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u043d\u0430\u0440\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <em>false<\/em>.<\/p>\n<\/li>\n<li>\n<p>False \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a unsigned char, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f <em>0b0000&#8217;0000<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u0418&#187; \u0441 0 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u0430\u0451\u0442 0, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 0.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439: \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>type<\/em> \u043c\u0435\u043d\u044c\u0448\u0435 7.<\/p>\n<ul>\n<li>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>(uint8_t) &#8212; (type &lt; 7)<\/em> \u0440\u0430\u0432\u043d\u043e 1.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>0x43u >> type<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 0x43 = 0b0100&#8217;0011.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f <em>0x43u >> type<\/em> \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u0418&#187; \u0441 1.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 <em>type<\/em> \u0440\u0430\u0432\u0435\u043d 0, 1 \u0438\u043b\u0438 6, \u0442\u043e \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d 1, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 1. \u0412\u043e \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f 0.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 type \u0440\u0430\u0432\u0435\u043d 0, 1 \u0438\u043b\u0438 6, \u0442\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e v3 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1, \u0430 \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0. \u0421\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 <em>(type == 0) || (type == 1) || (type == 6)<\/em>. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">typedef enum RenderTargetChannelType     {       kRenderTargetChannelTypeUNorm            = 0x00000000,       kRenderTargetChannelTypeSNorm            = 0x00000001,       kRenderTargetChannelTypeUInt             = 0x00000004,       kRenderTargetChannelTypeSInt             = 0x00000005,       kRenderTargetChannelTypeSrgb             = 0x00000006,       kRenderTargetChannelTypeFloat            = 0x00000007,     } RenderTargetChannelType;  void setDataFormat(DataFormat format) {   \/\/ ....   int v3;   RenderTargetChannelType  type;  \/\/ [rsp+4h] [rbp-3Ch]   __int64                  v9;  \/\/ [rsp+10h] [rbp-30h]   bool typeConvertable = format.getRenderTargetChannelType(&amp;type);   v2                   = type | kRenderTargetChannelTypeSNorm;   v3                   = (type == kRenderTargetChannelTypeUNorm)                       || (type == kRenderTargetChannelTypeSNorm)                       || (type == kRenderTargetChannelTypeSrgb);   \/\/ .... } <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u0447\u0438\u0441\u043b\u0430 0, 1 \u0438 6 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u043e\u0434\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<h3>\u041a\u0440\u0430\u0435\u0432\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v794\/\" rel=\"noopener noreferrer nofollow\">V794<\/a> The assignment operator should be protected from the case of &#8216;this == &amp;other&#8217;. VltShader.cpp 39<\/p>\n<pre><code class=\"cpp\">VltShaderConstData&amp; VltShaderConstData::operator=(VltShaderConstData&amp;&amp; other) {   delete[] m_data;   this->m_size = other.m_size;   this->m_data = other.m_data;   other.m_size = 0;   other.m_data = nullptr;   return *this; } <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <em>&#8216;this == &amp;other&#8217;<\/em>, \u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u043e\u0447\u0438\u0449\u0435\u043d\u044b \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f. \u0422\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. \u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">VltShaderConstData&amp; VltShaderConstData::operator=(VltShaderConstData&amp;&amp; other) {   if (this == &amp;other)   {     return *this;   }    delete[] m_data;   this->m_size = other.m_size;   this->m_data = other.m_data;   other.m_size = 0;   other.m_data = nullptr;   return *this; } <\/code><\/pre>\n<h3>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043f\u043e\u0432\u043e\u0434 \u0434\u043b\u044f \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v1048\/\" rel=\"noopener noreferrer nofollow\">V1048<\/a> [CWE-1164] The &#8216;retVal&#8217; variable was assigned the same value. Module.cpp 129<\/p>\n<pre><code class=\"cpp\">bool NativeModule::getSymbolInfo( \/* .... *\/) const {   bool retVal = false;   do   {     uint32_t modId = 0, libId = 0;     if (modName == nullptr || libName == nullptr || nid == nullptr)       {         break;       }       if (!isEncodedSymbol(encSymbol))       {         *modName = \"\";         *libName = \"\";         *nid     = 0;         retVal   = true;         break;       }       retVal = decodeSymbol(encSymbol, &amp;modId, &amp;libId, nid);       if (!retVal)       {         LOG_ERR(\"fail to decode encoded symbol\");         break;       }       retVal = getModNameFromId(modId, mods, modName);       if (!retVal)       {         LOG_ERR(\"fail to get module name for symbol: %s in %s\",         encSymbol.c_str(), fileName.c_str());         break;       }       retVal = getLibNameFromId(libId, libs, libName);       if (!retVal)       {         LOG_ERR(\"fail to get library name\");         break;       }       retVal = true;                                                      \/\/ &lt;=     } while (false);   return retVal; } <\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>true<\/em> \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <em>retVal<\/em>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>retVal<\/em> \u0434\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>retVal<\/em> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <em>false<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>isEncodedSymbol<\/em> \u0432\u0435\u0440\u043d\u0443\u043b <em>false<\/em>, \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>retVal<\/em> \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>true<\/em> \u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0446\u0438\u043a\u043b <em>do-while<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>retVal<\/em> \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>decodeSymbol<\/em>. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u043b\u0438 <em>retVal == false<\/em>, \u0442\u043e \u0446\u0438\u043a\u043b <em>do-while<\/em> \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u0441 \u0434\u0432\u0443\u043c\u044f \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>getModNameFromId<\/em>. \u0415\u0441\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432\u0435\u0440\u043d\u0451\u0442 <em>false<\/em>, \u0442\u043e \u0446\u0438\u043a\u043b <em>do-while<\/em> \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0446\u0438\u043a\u043b <em>do-while<\/em> \u0431\u044b\u043b \u0434\u043e\u0441\u0440\u043e\u0447\u043d\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u043d, \u0442\u043e \u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 <em>retVal == true<\/em> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0435\u0440\u043d\u0443\u043b\u0438 <em>true<\/em>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>retVal<\/em> \u0443\u0436\u0435 \u0440\u0430\u0432\u043d\u0430 <em>true<\/em>, \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430.<\/p>\n<p>\u0410 \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e &#8216;<em>do &#8230; while(false)<\/em>&#8216;? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u043d\u043d\u0438\u0439 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u043e\u0434\u043d\u0438\u043c <em>return<\/em>. \u041a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0441 \u043e\u0434\u043d\u0438\u043c <em>return<\/em>, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/terms\/6516\/\" rel=\"noopener noreferrer nofollow\">NRVO<\/a> \u2013 named return value optimization. \u042d\u0442\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u0443\u044f \u0435\u0433\u043e \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439 \u0442\u0438\u043f <em>bool<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043e\u0442 NRVO \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0443\u043c\u0435\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c NRVO \u0438 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c <a href=\"https:\/\/godbolt.org\/z\/GhTv4WTzr\" rel=\"noopener noreferrer nofollow\">\u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 <em>return<\/em><\/a>, \u0435\u0441\u043b\u0438 \u0432\u043e \u0432\u0441\u0435\u0445 <em>return<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <em>getSymbolInfo<\/em> \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a, \u043a\u0430\u043a \u0437\u0430\u0434\u0443\u043c\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043c\u0435\u0442\u043e\u0434\u0430 *getSymbolInfo *\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0446\u0438\u043a\u043b <em>do-while<\/em> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>retVal<\/em>. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">bool NativeModule::getSymbolInfo( \/* .... *\/) const {   uint32_t modId = 0, libId = 0;   if (modName == nullptr || libName == nullptr || nid == nullptr)   {     return false;   }    if (!isEncodedSymbol(encSymbol))   {     *modName = \"\";     *libName = \"\";     *nid     = 0;     return true;   }    if (!decodeSymbol(encSymbol, &amp;modId, &amp;libId, nid))   {     LOG_ERR(\"fail to decode encoded symbol\");     return false;   }    if (!getModNameFromId(modId, mods, modName))   {     LOG_ERR(\"fail to get module name for symbol: %s in %s\",     encSymbol.c_str(), fileName.c_str());     return false;   }    if (!getLibNameFromId(libId, libs, libName))   {     LOG_ERR(\"fail to get library name\");     return false;   }    return true; } <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>\u0443\u0431\u0440\u0430\u043b \u0446\u0438\u043a\u043b <em>do-while<\/em> \u0438 \u043b\u0438\u0448\u043d\u044e\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <em>retVal<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>retVal<\/em> \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0436\u0434\u044b\u0439 <em>break<\/em> \u0446\u0438\u043a\u043b\u0430 <em>do-while<\/em> \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>true<\/em> \/ <em>false<\/em>. \u041a\u0430\u043a\u043e\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c, \u0437\u043d\u0430\u0435\u043c \u0438\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>retVal<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0449\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0432 GPCS4. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0431\u044b\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u0438\u0445 \u0432 \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>\u041c\u044b \u0436\u0435\u043b\u0430\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c GPCS4 \u0443\u0441\u043f\u0435\u0445\u043e\u0432 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0438 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c PVS-Studio. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e <a href=\"https:\/\/pvs-studio.com\/ru\/pvs-studio\/try-free\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432<\/a> \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0443\u044e \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u044e \u0434\u043b\u044f Open Source \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u0432\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432 \u0446\u0435\u043b\u043e\u043c \u0438 PVS-Studio \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u2013 \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c GPCS4 \u0432\u0441\u043b\u0435\u0434 \u0437\u0430 \u043d\u0430\u043c\u0438, \u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:) \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0955\/\" rel=\"noopener noreferrer nofollow\"><strong>Checking the GPCS4 emulator: will we ever be able to play &#171;Bloodborne&#187; on PC?<\/strong><\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/671754\/\"> https:\/\/habr.com\/ru\/post\/671754\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u042d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u2013 \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439. \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f GPCS4, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0433\u0440 \u0434\u043b\u044f PS4 \u043d\u0430 PC. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 GPCS4, \u0438 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 PVS-Studio \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u041e \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/h3>\n<p>GPCS4 \u2013 \u044d\u0442\u043e \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 PlayStation 4, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 C \u0438 C++.<\/p>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0446\u0435\u043b\u044c\u044e \u0430\u0432\u0442\u043e\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u044b\u043b\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 PS4. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u0441\u044f, \u0438 \u0443\u0436\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 2020 \u0433\u043e\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c GPCS4 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0438\u0433\u0440\u0443 <a href=\"https:\/\/habr.com\/ru\/news\/t\/487050\/\" rel=\"noopener noreferrer nofollow\">We are Doomed<\/a>. \u042d\u0442\u043e \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u044b\u0439 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430 PC \u0438\u0433\u0440\u044b \u0434\u043b\u044f PS4. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u0430\u043c \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u0431\u044b\u043b \u0434\u0430\u043b\u0451\u043a \u043e\u0442 \u0438\u0434\u0435\u0430\u043b\u0430: \u0438\u0433\u0440\u0430 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0434\u0451\u0440\u0433\u0430\u043b\u0430\u0441\u044c. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, <a href=\"https:\/\/github.com\/Inori\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a> \u043f\u043e\u043b\u043e\u043d \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0437\u043c\u0430 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0430\u043f\u0440\u0435\u043b\u044f 2022 \u0433\u043e\u0434\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0441\u044f <a href=\"https:\/\/github.com\/Inori\/GPCS4\/releases\/tag\/v0.1.0\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 GPCS4<\/a>. \u042f \u0441\u043a\u0430\u0447\u0430\u043b \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u0432\u0435\u0440\u0441\u0438\u044e 0.1.0 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041a \u0441\u043b\u043e\u0432\u0443, \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0443\u0436\u0435 \u0432\u044b\u0448\u0435\u043b \u0440\u0435\u043b\u0438\u0437 0.2.0 \u2013 \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0438 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443 PVS-Studio \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 GPCS4.<\/p>\n<h3>\u041f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u044b\u0439 break<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v794\" rel=\"noopener noreferrer nofollow\">V796<\/a> [CWE-484] It is possible that &#8216;break&#8217; statement is missing in switch statement. AudioOut.cpp 137<\/p>\n<pre><code class=\"cpp\">static AudioProperties getAudioProperties(uint32_t param) {   uint32_t format       = param &amp; 0x000000ff;   AudioProperties props = {};    switch (format)   {     \/\/ ....     case SCE_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD:     {       props.nChannels   = 8;       props.bytesPerSample  = 2;       props.audioFormat = RTAUDIO_FORMAT_SINT16;       break;     }     case SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO:     {       props.nChannels   = 1;       props.bytesPerSample  = 4;       props.audioFormat = RTAUDIO_FORMAT_FLOAT32;         \/\/ &lt;=     }     case SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_STEREO:     {       props.nChannels   = 2;       props.bytesPerSample  = 4;       props.audioFormat = RTAUDIO_FORMAT_FLOAT32;       break;     }   }   return props; } <\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f <em>SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO<\/em> \u043f\u043e\u0442\u0435\u0440\u044f\u043d <em>break<\/em>. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.<\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v595\/\" rel=\"noopener noreferrer nofollow\">V595<\/a> The &#8216;m_moduleData&#8217; pointer was utilized before it was verified against nullptr. Check lines: 49, 53. ELFMapper.cpp 49<\/p>\n<pre><code class=\"cpp\">struct NativeModule { \/*....*\/ };  class ELFMapper {   \/\/ ....   NativeModule *m_moduleData; };  bool ELFMapper::validateHeader() {   bool retVal      = false;   auto &amp;fileMemory = m_moduleData->m_fileMemory;   do   {     if (m_moduleData == nullptr)     {       LOG_ERR(\"file has not been loaded\");       break;     }     \/\/ ....   } while (false);      return retVal; } <\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>m_moduleData<\/em> \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 <em>do-while<\/em> \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 <em>nullptr<\/em>.<\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442\u044c: &#171;\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430 \u0432\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c? \u0410 \u043f\u043e\u0442\u043e\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 <em>do-while<\/em> \u044d\u0442\u043e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c? \u0422\u043e\u0433\u0434\u0430 \u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0443\u0442 \u043d\u0435\u0442&#187;. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0438\u0437-\u0437\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f <em>while (false)<\/em> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0446\u0438\u043a\u043b\u0430. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>m_moduleData<\/em> <a href=\"https:\/\/github.com\/Inori\/GPCS4\/blob\/67442ae29df1916137a01b87b675375d8b48be0e\/GPCS4\/Loader\/ELFMapper.cpp#L45-L88\" rel=\"noopener noreferrer nofollow\">\u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/a>.<\/p>\n<p>\u0414\u0440\u0443\u0433\u043e\u0435 \u0432\u043e\u0437\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0437\u044f\u0442\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u2013 \u044d\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u0412\u0435\u0434\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u0431\u0443\u0434\u0435\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439. \u041d\u043e \u043d\u0435\u0442, \u0442\u0430\u043a\u043e\u0439 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0306\/\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a>. \u042d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0434\u043e \u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">bool ELFMapper::validateHeader() {   bool retVal      = false;      do   {     if (m_moduleData == nullptr)     {       LOG_ERR(\"file has not been loaded\");       break;     }      auto &amp;fileMemory = m_moduleData->m_fileMemory;     \/\/ ....   } while (false);    return retVal; } <\/code><\/pre>\n<h3>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v519\/\" rel=\"noopener noreferrer nofollow\">V519<\/a> [CWE-563] The &#8216;* memoryType&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 54, 55. sce_kernel_memory.cpp 55<\/p>\n<pre><code class=\"cpp\">int PS4API sceKernelGetDirectMemoryType(sce_off_t start, int *memoryType,      sce_off_t *regionStartOut, sce_off_t *regionEndOut) {   LOG_SCE_DUMMY_IMPL();   *memoryType = SCE_KERNEL_WB_GARLIC;   *memoryType = SCE_KERNEL_WC_GARLIC;   return SCE_OK; } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e <em>LOG_SCE_DUMMY_IMPL<\/em>, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <em>sceKernelGetDirectMemoryType<\/em> \u0435\u0449\u0451 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f. \u0418 \u0432\u0441\u0451 \u0436\u0435, \u0434\u0432\u0430 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u0430\u0434\u0440\u0435\u0441\u0443 <em>memoryType<\/em> \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v512\/\" rel=\"noopener noreferrer nofollow\">V512<\/a> [CWE-119] A call of the &#8216;memset&#8217; function will lead to overflow of the buffer &#8216;param->reserved&#8217;. sce_gnm_draw.cpp 420<\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v531\/\" rel=\"noopener noreferrer nofollow\">V531<\/a> [CWE-131] It is odd that a sizeof() operator is multiplied by sizeof(). sce_gnm_draw.cpp 420<\/p>\n<pre><code class=\"cpp\">struct GnmCmdPSShader {   uint32_t              opcode;   gcn::PsStageRegisters psRegs;   uint32_t              reserved[27]; };  int PS4API sceGnmSetPsShader350(uint32_t* cmdBuffer, uint32_t numDwords,                                  const gcn::PsStageRegisters *psRegs) {   \/\/ ....   memset(param->reserved, 0, sizeof(param->reserved) * sizeof(uint32_t));    return SCE_OK; } <\/code><\/pre>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u043e\u0434\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a PVS-Studio. \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>memset<\/em> \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0442\u044c\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c. \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>sizeof(param->reserved)<\/em> \u0443\u0436\u0435 \u0432\u0435\u0440\u043d\u0451\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>param->reserved<\/em>. \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 <em>sizeof(uint32_t)<\/em> \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 4 \u0440\u0430\u0437\u0430, \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <em>memset<\/em> \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>param->reserved<\/em>. \u041d\u0443\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cpp\">int PS4API sceGnmSetPsShader350( \/*....*\/ ) {   \/\/ ....   memset(param->reserved, 0, sizeof(param->reserved));   return SCE_OK; } <\/code><\/pre>\n<p>\u0412\u0441\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b 20 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v512\/\" rel=\"noopener noreferrer nofollow\">V512<\/a> [CWE-119] A call of the &#8216;memset&#8217; function will lead to overflow of the buffer &#8216;initParam->reserved&#8217;. sce_gnm_dispatch.cpp 16<\/p>\n<pre><code class=\"cpp\">uint32_t PS4API sceGnmDispatchInitDefaultHardwareState(uint32_t* cmdBuffer,                                                        uint32_t numDwords) {   \/\/ ....   memset(initParam->reserved, 0,          sizeof(initParam->reserved) * sizeof(uint32_t));   return initCmdSize; } <\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>initParam->reserved<\/em>.<\/p>\n<h3>\u0423\u0447\u0438\u043c\u0441\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e \u0441\u0435\u043c\u0438, \u0438\u043b\u0438 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v557\/\" rel=\"noopener noreferrer nofollow\">V557<\/a> [CWE-787] Array overrun is possible. The &#8216;dynamicStateCount ++&#8217; index is pointing beyond array bound. VltGraphics.cpp 157<\/p>\n<pre><code class=\"cpp\">VkPipeline VltGraphicsPipeline::createPipeline(\/* .... *\/) const {   \/\/ ....   std::array&lt;VkDynamicState, 6> dynamicStates;   uint32_t                      dynamicStateCount = 0;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR;   if (state.useDynamicDepthBias())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BIAS;   if (state.useDynamicDepthBounds())   {     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS;     dynamicStates[dynamicStateCount++] =                              VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE;   }   if (state.useDynamicBlendConstants())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_BLEND_CONSTANTS;   if (state.useDynamicStencilRef())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE;   \/\/ .... } <\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>dynamicStates<\/em>. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u0435\u0441\u0442\u044c 4 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>if (state.useDynamicDepthBias())<\/p>\n<\/li>\n<li>\n<p>if (state.useDynamicDepthBounds())<\/p>\n<\/li>\n<li>\n<p>if (state.useDynamicBlendConstants())<\/p>\n<\/li>\n<li>\n<p>if (state.useDynamicStencilRef())<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0444\u043b\u0430\u0433\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>if (state.useDynamicDepthBias())<\/em>:<\/p>\n<pre><code class=\"cpp\">bool useDynamicDepthBias() const {   return rs.depthBiasEnable(); }  VkBool32 depthBiasEnable() const {   return VkBool32(m_depthBiasEnable); } <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0432\u0441\u0435 \u044d\u0442\u0438 4 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u043c\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0422\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f 7 \u0441\u0442\u0440\u043e\u043a \u0432\u0438\u0434\u0430 <em>&#8216;dynamicStates[dynamicStateCount++] = &#8230;.&#8217;<\/em>. \u041d\u0430 \u0441\u0435\u0434\u044c\u043c\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a <em>dynamicStates[6]<\/em>. \u042d\u0442\u043e \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 7 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">VkPipeline VltGraphicsPipeline::createPipeline(\/* .... *\/) const {   \/\/ ....   std::array&lt;VkDynamicState, 7> dynamicStates; \/\/ &lt;=   uint32_t                      dynamicStateCount = 0;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT;   dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR;   if (state.useDynamicDepthBias())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BIAS;   if (state.useDynamicDepthBounds())   {     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_DEPTH_BOUNDS;     dynamicStates[dynamicStateCount++] =                              VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE;   }   if (state.useDynamicBlendConstants())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_BLEND_CONSTANTS;   if (state.useDynamicStencilRef())     dynamicStates[dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE;   \/\/ .... } <\/code><\/pre>\n<h3>\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430<\/h3>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v547\/\" rel=\"noopener noreferrer nofollow\">V547<\/a> [CWE-570] Expression &#8216;nOldFlag &amp; VMPF_NOACCESS&#8217; is always false. PlatMemory.cpp 22<\/p>\n<pre><code class=\"cpp\">#define PAGE_NOACCESS           0x01 #define PAGE_READONLY           0x02 #define PAGE_READWRITE          0x04 #define PAGE_EXECUTE            0x10 #define PAGE_EXECUTE_READ       0x20 #define PAGE_EXECUTE_READWRITE  0x40  enum VM_PROTECT_FLAG {   VMPF_NOACCESS  = 0x00000000,   VMPF_CPU_READ  = 0x00000001,   VMPF_CPU_WRITE = 0x00000002,   VMPF_CPU_EXEC  = 0x00000004,   VMPF_CPU_RW    = VMPF_CPU_READ | VMPF_CPU_WRITE,   VMPF_CPU_RWX   = VMPF_CPU_READ | VMPF_CPU_WRITE | VMPF_CPU_EXEC, };  inline uint32_t GetProtectFlag(VM_PROTECT_FLAG nOldFlag) {   uint32_t nNewFlag = 0;   do   {     if (nOldFlag &amp; VMPF_NOACCESS)     {       nNewFlag = PAGE_NOACCESS;       break;     }      if (nOldFlag &amp; VMPF_CPU_READ)     {       nNewFlag = PAGE_READONLY;     }      if (nOldFlag &amp; VMPF_CPU_WRITE)     {       nNewFlag =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-334594","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334594"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334594\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}