{"id":281330,"date":"2016-11-22T12:50:05","date_gmt":"2016-11-22T09:50:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=281330"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=281330","title":{"rendered":"Linux-\u0432\u0435\u0440\u0441\u0438\u044f PVS-Studio \u0443\u0441\u0442\u0440\u043e\u0438\u043b\u0430 \u0441\u0435\u0431\u0435 \u044d\u043a\u0441\u043a\u0443\u0440\u0441\u0438\u044e \u043f\u043e Disney"},"content":{"rendered":"<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/43b\/fc9\/0ce\/43bfc90ce2367bfe20057be2382a62ba.png\" \/><\/div>\n<\/p>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u043b\u0430 \u0432 \u0441\u0432\u0435\u0442 Linux-\u0432\u0435\u0440\u0441\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio. \u0421 \u0435\u0435 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u044b\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d \u0440\u044f\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u0421\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 Chromium, GCC, LLVM (Clang) \u0438 \u0434\u0440\u0443\u0433\u0438\u0435. \u0418 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b Walt Disney Animation Studios \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e Disney<\/h2>\n<p>  \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Walt Disney \u0432\u043e\u0442 \u0443\u0436\u0435 \u043c\u043d\u043e\u0433\u043e \u043b\u0435\u0442 \u0440\u0430\u0434\u0443\u0435\u0442 \u0442\u0435\u043b\u0435\u0432\u0438\u0437\u0438\u043e\u043d\u043d\u0443\u044e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044e \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d \u043c\u0438\u0440\u0430 \u0432\u043e\u0441\u0445\u0438\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u044f\u043c\u0438 \u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430\u043c\u0438, \u0434\u0430\u0440\u044f \u0435\u0439 \u043d\u0435\u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f. \u0418\u0437 \u0433\u043e\u0434\u0430 \u0432 \u0433\u043e\u0434 Disney \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435, \u0437\u0440\u0435\u043b\u0438\u0449\u043d\u044b\u0435 \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0438\u043b\u044c\u043c\u044b, \u0438 \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c\u044b. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432 \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u043e\u0432 \u043f\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c. <\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b Walt Disney Animation Studios \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u0430\u043c \u043f\u043e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 C \u0438 C++ \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u043e\u0442\u0440\u0430\u0441\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041a \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438: <\/p>\n<ul>\n<li>Partio (\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446 \u0447\u0435\u0440\u0435\u0437 \u0435\u0434\u0438\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443, \u0447\u0442\u043e \u0438 \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439)<\/li>\n<li>Alembic (\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0431\u043c\u0435\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430)<\/li>\n<li>Universal Scene Description (\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438)<\/li>\n<li>OpenSubdiv (\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0435\u0439 (subdivision surface) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439)<\/li>\n<li>Dinamica (\u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Autodesk Maya, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 Bullet Physics Library )<\/li>\n<li>PTex (\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440)<\/li>\n<\/ul>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043e\u0442 Disney \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/disney.github.io\/\">https:\/\/disney.github.io\/<\/a>.<\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/h2>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043e\u0442 Walt Disney \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0438 \u0438 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0442\u044b\u0441\u044f\u0447 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 C \u0438 C++. \u041e\u0442\u0441\u044e\u0434\u0430 \u0438 \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c.<\/p>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442 Partio<\/h3>\n<p>  <\/p>\n<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9b5\/28c\/9c7\/9b528c9c79acef4761c9336daf365ac3.png\" \/><\/div>\n<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V547\/\">V547<\/a> Expression &#8216;\u00abR\u00bb&#8217; is always true. PDA.cpp 90  <\/p>\n<pre><code class=\"cpp\">ParticlesDataMutable* readPDA(....) {   ....   while(input-&gt;good())   {     *input&gt;&gt;word;     ....     if(word==&quot;V&quot;){         attrs.push_back(simple-&gt;addAttribute(....);     }else if(&quot;R&quot;){                                 \/\/ &lt;=         attrs.push_back(simple-&gt;addAttribute(....);     }else if(&quot;I&quot;){                                 \/\/ &lt;=         attrs.push_back(simple-&gt;addAttribute(....);     }     index++;   }   .... }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u0430. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 <i>else <\/i> \u0432\u0435\u0442\u043a\u0435, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e. \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0442\u0430\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0435, \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cpp\">.... if(word==&quot;V&quot;){     attrs.push_back(simple-&gt;addAttribute(....); }else if(word==&quot;R&quot;){                                \/\/ &lt;=     attrs.push_back(simple-&gt;addAttribute(....); }else if(word==&quot;I&quot;){                                \/\/ &lt;=     attrs.push_back(simple-&gt;addAttribute(....); } ....<\/code><\/pre>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V528\/\">V528<\/a> It is odd that pointer to &#8216;char&#8217; type is compared with the &#8216;\\0&#8217; value. Probably meant: *charArray[i] != &#8216;\\0&#8217;. MC.cpp 109  <\/p>\n<pre><code class=\"cpp\">int CharArrayLen(char** charArray) {   int i = 0;   if(charArray != false)   {     while(charArray[i] != '\\0')   \/\/ &lt;=     {       i++;     }   }   return i; }<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>CharArrayLen <\/i>\u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <i>charArray<\/i>. \u041d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a? \u041f\u043e-\u043c\u043e\u0435\u043c\u0443, \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 <i>while <\/i> \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0438\u043f <i>char<\/i> \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <i>&#8216;\\0&#8217;<\/i>. \u0412\u044b\u0441\u043e\u043a\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0437\u0430\u0431\u044b\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0446\u0438\u043a\u043b\u0430 <i>while <\/i> \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:   <\/p>\n<pre><code class=\"cpp\">while ((*charArray)[i] != '\\0')<\/code><\/pre>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435, \u0442\u043e\u0436\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f:  <\/p>\n<pre><code class=\"cpp\">if(charArray != false)<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0451 \u043d\u0430 \u0442\u0430\u043a\u0443\u044e:  <\/p>\n<pre><code class=\"cpp\">if(charArray != nullptr)<\/code><\/pre>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0441\u0442\u0430\u0436\u0451\u0440, \u0438\u043b\u0438 \u043e\u043d\u0430 \u043d\u0435 \u0434\u043e\u043f\u0438\u0441\u0430\u043d\u0430. \u041d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>strlen()<\/i>:  <\/p>\n<pre><code class=\"cpp\">int CharArrayLen(const char** charArray) {   if (charArray == nullptr)     return 0;   return strlen(*charArray); }<\/code><\/pre>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V701\/\">V701<\/a> realloc() possible leak: when realloc() fails in allocating memory, original pointer &#8216;attributeData[i]&#8217; is lost. Consider assigning realloc() to a temporary pointer. ParticleSimple.cpp 266  <\/p>\n<pre><code class=\"cpp\">ParticleIndex ParticlesSimple:: addParticle() {   ....   for(unsigned int i=0;i&lt;attributes.size();i++)     attributeData[i]=                   (char*)realloc(attributeData[i],       \/\/ &lt;=                                 (size_t)attributeStrides[i]*                                 (size_t)allocatedCount);   .... }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u044f\u0432\u0438\u043b \u0432 \u043a\u043e\u0434\u0435 \u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <i>realloc<\/i>. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <i>foo = realloc(foo, &#8230;)<\/i> \u043e\u043f\u0430\u0441\u043d\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 <i>nullptr<\/i>, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u0442\u0435\u0447\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u0442\u043e \u0438 \u0432\u043e\u0432\u0441\u0435 \u043a \u043f\u0430\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u0440\u0435\u0434\u043a\u0430 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u044f \u0434\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u0436\u0435 \u0441\u0442\u043e\u0438\u0442. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <i>realloc<\/i>.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<ul>\n<li>V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer &#8216;attributeData[i]&#8217; is lost. Consider assigning realloc() to a temporary pointer. ParticleSimple.cpp 280<\/li>\n<li>V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer &#8216;data&#8217; is lost. Consider assigning realloc() to a temporary pointer. ParticleSimpleInterleave.cpp 281<\/li>\n<li>V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer &#8216;data&#8217; is lost. Consider assigning realloc() to a temporary pointer. ParticleSimpleInterleave.cpp 292<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442 Alembic<\/h3>\n<p>  <\/p>\n<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f0d\/231\/e0d\/f0d231e0dc0c84fcc16019e49d948aea.png\" \/><\/div>\n<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V501\/\">V501<\/a> There are identical sub-expressions &#8216;m_uKnot&#8217; to the left and to the right of the &#8216;||&#8217; operator. ONuPatch.h 253   <\/p>\n<pre><code class=\"cpp\">class Sample {   public:     ....     bool hasKnotSampleData() const     {       if( (m_numU != ABC_GEOM_NUPATCH_NULL_INT_VALUE) ||           (m_numV != ABC_GEOM_NUPATCH_NULL_INT_VALUE) ||           (m_uOrder != ABC_GEOM_NUPATCH_NULL_INT_VALUE) ||           (m_vOrder != ABC_GEOM_NUPATCH_NULL_INT_VALUE) ||            m_uKnot || m_uKnot)                            \/\/ &lt;=            return true;       else           return false;     }     ....   protected:     ....     int32_t m_numU;     int32_t m_numV;     int32_t m_uOrder;     int32_t m_vOrder;     Abc::FloatArraySample m_uKnot;     Abc::FloatArraySample m_vKnot;     .... }<\/code><\/pre>\n<p>  \u0418 \u0441\u043d\u043e\u0432\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0440\u0430\u0441\u0441\u0435\u044f\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430. \u041d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043f\u043e\u043b\u044f <i>m_uKnot <\/i>\u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u0442\u043e\u044f\u0442\u044c <i>m_vKnot<\/i>. <\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V523\/\">V523<\/a> The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. OFaceSet.cpp 230  <\/p>\n<pre><code class=\"cpp\">void OFaceSetSchema::set( const Sample &amp;iSamp ) {   ....   if ( iSamp.getSelfBounds().hasVolume() )   {       \/\/ Caller explicity set bounds for this sample of the faceset.              m_selfBoundsProperty.set( iSamp.getSelfBounds() );   \/\/ &lt;=   }   else                                          {       m_selfBoundsProperty.set( iSamp.getSelfBounds() );   \/\/ &lt;=              \/\/ NYI compute self bounds via parent mesh's faces   }   .... }  <\/code><\/pre>\n<p>  PVS-Studio \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0432 \u043a\u043e\u0434\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>if..else<\/i>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432 \u043e\u0431\u043e\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u0430\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. \u0412\u043f\u043e\u043b\u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0442\u043e\u043c\u0438\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u043d\u0443 \u0430 \u043f\u043e\u043a\u0430 \u044d\u0442\u043e\u0442 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u043e\u0448\u0438\u0431\u043e\u0447\u0435\u043d \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V629\/\">V629<\/a> Consider inspecting the &#8216;1 &lt;&lt; iStreamID&#8217; expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type. StreamManager.cpp 176  <\/p>\n<pre><code class=\"cpp\">void StreamManager::put( std::size_t iStreamID ) {   ....   \/\/ CAS (compare and swap) non locking version   Alembic::Util::int64_t oldVal = 0;   Alembic::Util::int64_t newVal = 0;    do   {     oldVal = m_streams;     newVal = oldVal | ( 1 &lt;&lt; iStreamID );             \/\/ &lt;=   }   while ( ! COMPARE_EXCHANGE( m_streams, oldVal, newVal ) ); }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0434\u0432\u0438\u0433\u0430. <\/p>\n<p>  \u0412 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 <i>newVal = oldVal | (1 &lt;&lt; iStreamID )<\/i> \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043a\u0430\u043a <i>int<\/i>, \u0438 \u0434\u0430\u043b\u0435\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0434\u0432\u0438\u0433\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u043a 64-\u0431\u0438\u0442\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443. \u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>iStreamID<\/i> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 32, \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438\u0437-\u0437\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041a\u043e\u0434 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e 1 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e 64-\u0431\u0438\u0442\u043d\u044b\u043c \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"cpp\"> newVal = oldVal | (  Alembic::Util::int64_t(1) &lt;&lt; iStreamID );<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/p>\n<ul>\n<li>V629 Consider inspecting the &#8216;1 &lt;&lt; (val \u2014 1)&#8217; expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type. StreamManager.cpp 148<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442 Universal Scene Description<\/h3>\n<p>  <\/p>\n<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1ae\/9ac\/db2\/1ae9acdb223284031e774b3f7a3a7195.png\" \/><\/div>\n<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V668\/\">V668<\/a> There is no sense in testing the &#8216;_rawBuffer&#8217; pointer against null, as the memory was allocated using the &#8216;new&#8217; operator. The exception will be generated in the case of memory allocation error. uvTextureStorageData.cpp 118  <\/p>\n<pre><code class=\"cpp\">bool GlfUVTextureStorageData::Read(....)  {   ....   _rawBuffer = new unsigned char[_size];                   \/\/ &lt;=   if (_rawBuffer == nullptr) {                             \/\/ &lt;=       TF_RUNTIME_ERROR(&quot;Unable to allocate buffer.&quot;);       return false;   }   ....   return true;  }<\/code><\/pre>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u044f\u0437\u044b\u043a\u0430, <i>new<\/i> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430 \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <i>nullptr<\/i>. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u2014 \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0439 \u0430\u0440\u0445\u0430\u0438\u0437\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u044d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c. <\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V501\/\">V501<\/a> There are identical sub-expressions &#8216;HdChangeTracker::DirtyPrimVar&#8217; to the left and to the right of the &#8216;|&#8217; operator. basisCurves.cpp 563  <\/p>\n<pre><code class=\"cpp\">HdBasisCurves::_GetInitialDirtyBits() const {   int mask = HdChangeTracker::Clean;    mask |= HdChangeTracker::DirtyPrimVar     \/\/ &lt;=        |  HdChangeTracker::DirtyWidths        |  HdChangeTracker::DirtyRefineLevel        |  HdChangeTracker::DirtyPoints        |  HdChangeTracker::DirtyNormals        |  HdChangeTracker::DirtyPrimVar     \/\/ &lt;=        |  HdChangeTracker::DirtyTopology        ....       ;    return (HdChangeTracker::DirtyBits)mask; }<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f <i>mask <\/i> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0439, \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f. \u0422\u0430\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0438\u043b\u0438 \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u043f\u043e \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e\u0436\u0435 \u043f\u043e\u043b\u0435, \u0438\u043b\u0438, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043f\u043e\u043b\u044f <i>DirtyPrimVar<\/i> \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u043f\u043e\u043b\u0435. <\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/p>\n<ul>\n<li>V501 There are identical sub-expressions &#8216;HdChangeTracker::DirtyPrimVar&#8217; to the left and to the right of the &#8216;|&#8217; operator. mesh.cpp 1199 <\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442 OpenSubdiv<\/h3>\n<p>  <\/p>\n<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/70f\/2df\/8a0\/70f2df8a07a91b632b1b101914949162.png\" \/><\/div>\n<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V595\/\">V595<\/a> The &#8216;destination&#8217; pointer was utilized before it was verified against nullptr. Check lines: 481, 483. hbr_utils.h 481  <\/p>\n<pre><code class=\"cpp\">template &lt;class T&gt; void createTopology(....)  {   ....   OpenSubdiv::HbrVertex&lt;T&gt; * destination =                          mesh-&gt;GetVertex( fv[(j+1)%nv] );   OpenSubdiv::HbrHalfedge&lt;T&gt; * opposite  =                          destination-&gt;GetEdge(origin);  \/\/ &lt;=    if(origin==NULL || destination==NULL)                \/\/ &lt;=   {                   printf(....);     valid=false;     break;   }   .... } <\/code><\/pre>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439, V595 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c, \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c. PVS-Studio \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043e\u0434 \u043e\u043f\u0430\u0441\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0438\u0436\u0435 \u043f\u043e \u043a\u043e\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442, \u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442, \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e. <\/p>\n<p>  \u0422\u0430\u043a \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0443\u0447\u0430\u0441\u0442\u043a\u0435 \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f <i>opposite<\/i> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f <i>destination,<\/i> \u0430 \u0434\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u044d\u0442\u0438\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <i>NULL<\/i>. <\/p>\n<p>  \u0418 \u0435\u0449\u0435 \u043f\u0430\u0440\u043e\u0447\u043a\u0430 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439: <\/p>\n<ul>\n<li>V595 The &#8216;destination&#8217; pointer was utilized before it was verified against nullptr. Check lines: 145, 148. hbr_tutorial_1.cpp 145<\/li>\n<li>V595 The &#8216;destination&#8217; pointer was utilized before it was verified against nullptr. Check lines: 215, 218. hbr_tutorial_2.cpp 215<\/li>\n<\/ul>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V547\/\">V547<\/a> Expression &#8216;buffer[0] == &#8216;\\r&#8217; &amp;&amp; buffer[0] == &#8216;\\n &#8216; &#8216; is always false. Probably the &#8216;||&#8217; operator should be used here. hdr_reader.cpp 84   <\/p>\n<pre><code class=\"cpp\">unsigned char *loadHdr(....) {   ....   char buffer[MAXLINE];   \/\/ read header   while(true)    {     if (! fgets(buffer, MAXLINE, fp)) goto error;     if (buffer[0] == '\\n') break;     if (buffer[0] == '\\r' &amp;&amp; buffer[0] == '\\n') break;   \/\/ &lt;=     ....   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0432\u043d\u043e <i>false<\/i>. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0445\u043e\u0442\u0435\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0430\u043a <i>\\n<\/i> \u0438\u043b\u0438 <i>\\r\\n<\/i>, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 <i>while<\/i>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cpp\"> if (buffer[0] == '\\r' &amp;&amp; buffer[1] == '\\n') break;   <\/code><\/pre>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V593\/\">V593<\/a> Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. main.cpp 652  <\/p>\n<pre><code class=\"cpp\">main(int argc, char ** argv)  {   ....   #if defined(OSD_USES_GLEW)   if (GLenum r = glewInit() != GLEW_OK) {                 \/\/ &lt;=       printf(&quot;Failed to initialize glew. error = %d\\n&quot;, r);       exit(1);   }   #endif .... }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 <i>GLenum r = glewInit() != GLEW_OK<\/i>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442. \u0421\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0445\u043e\u0447\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435:  <\/p>\n<pre><code class=\"cpp\">(GLenum r = glewInit()) != GLEW_OK<\/code><\/pre>\n<p>  \u041d\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &#8216;!=&#8217; \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">GLenum r = (glewInit() != GLEW_OK)<\/code><\/pre>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>glewInit()<\/i> \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u043d \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438. \u0422\u043e\u0447\u043d\u0435\u0435, \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0430.<\/p>\n<p>  \u0414\u043b\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u0431\u043a\u0438 \u0438\u043b\u0438 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0447\u0442\u043e \u043f\u0440\u0438\u0434\u0430\u0441\u0442 \u043a\u043e\u0434\u0443 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434. \u0421\u043c. \u0442\u0430\u043a\u0436\u0435 \u0433\u043b\u0430\u0432\u0443 16 \u0432 \u043a\u043d\u0438\u0433\u0435 &quot;<a href=\"http:\/\/www.viva64.com\/ru\/b\/0391\">\u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e<\/a>&quot;.<\/p>\n<p>  PVS-Studio \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043c\u0435\u0441\u0442:<\/p>\n<ul>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. glEvalLimit.cpp 1419<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. glStencilViewer.cpp 1128<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. farViewer.cpp 1406<\/li>\n<\/ul>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V701\/\">V701<\/a> realloc() possible leak: when realloc() fails in allocating memory, original pointer &#8216;m_blocks&#8217; is lost. Consider assigning realloc() to a temporary pointer. allocator.h 145  <\/p>\n<pre><code class=\"cpp\">template &lt;typename T&gt; T* HbrAllocator&lt;T&gt;::Allocate()  {   if (!m_freecount)    {     ....     \/\/ Keep track of the newly allocated block     if (m_nblocks + 1 &gt;= m_blockCapacity) {         m_blockCapacity = m_blockCapacity * 2;         if (m_blockCapacity &lt; 1) m_blockCapacity = 1;         m_blocks = (T**) realloc(m_blocks,                \/\/ &lt;=                                  m_blockCapacity * sizeof(T*));     }     m_blocks[m_nblocks] = block;                          \/\/ &lt;=     ....   }   .... } <\/code><\/pre>\n<p>  \u0418 \u0441\u043d\u043e\u0432\u0430 \u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>realloc<\/i>. \u0410 \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u043e \u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u2014 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 &#8216;\u041f\u0440\u043e\u0435\u043a\u0442 Partio&#8217;.<\/p>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442 Dynamica<\/h3>\n<p>  <\/p>\n<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5a6\/0e6\/571\/5a60e6571952e5cf9969b0d246b58b4b.png\" \/><\/div>\n<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V512\/\">V512<\/a> A call of the &#8216;memset&#8217; function will lead to overflow of the buffer &#8216;header.padding&#8217;. pdbIO.cpp 249  <\/p>\n<pre><code class=\"cpp\">struct pdb_header_t {   int       magic;   unsigned short swap;   float       version;   float       time;   unsigned int data_size;   unsigned int num_data;   char      padding[32];   \/\/pdb_channel_t   **data;   int             data; };  bool pdb_io_t::write(std::ostream &amp;out) {   pdb_header_t            header;   ....   header.magic = PDB_MAGIC;   header.swap = 0;   header.version = 1.0;   header.time = m_time;   header.data_size = m_num_particles;   header.num_data = m_attributes.size();   memset(header.padding, 0, 32 * sizeof(char) + sizeof(int));   .... } <\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 <i>header.padding<\/i>. \u0427\u0435\u0440\u0435\u0437 <i>memset <\/i>\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442 36 \u0431\u0430\u0439\u0442\u043e\u0432 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 <i>header.padding<\/i>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0432\u0441\u0435\u0433\u043e \u0438\u0437 32 \u0431\u0430\u0439\u0442<i>.<\/i> \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0442\u0430\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e, \u043d\u043e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0445\u0438\u0442\u0440\u0435\u0446\u043e\u043c \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <i>header.padding<\/i> \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <i>data.<\/i> \u0412\u0435\u0434\u044c \u043f\u043e\u043b\u044f <i>padding<\/i> \u0438 <i>data<\/i> \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <i>pdb_header_t<\/i> \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0414\u0430! \u041e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043d\u043e \u0438\u0437-\u0437\u0430 \u0442\u0430\u043a\u043e\u0439 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0438 \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <i>pdb_header_t<\/i>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044f\u043c\u0438 <i>padding<\/i> \u0438 <i>data<\/i> \u0441\u0432\u043e\u0438 \u043f\u043e\u043b\u044f, \u0438 \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u043e\u0431\u043d\u0443\u043b\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442 Ptex<\/h3>\n<p>  <\/p>\n<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a7c\/229\/19f\/a7c22919f0ff8b0e29c6e408bff427d5.png\" \/><\/div>\n<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio:<\/b> <a href=\"http:\/\/www.viva64.com\/ru\/w\/V612\/\">V612<\/a> An unconditional &#8216;return&#8217; within a loop. PtexHashMap.h 292  <\/p>\n<pre><code class=\"cpp\">Entry* lockEntriesAndGrowIfNeeded(size_t&amp; newMemUsed) {   while (_size*2 &gt;= _numEntries) {       Entry* entries = lockEntries();       if (_size*2 &gt;= _numEntries) {           entries = grow(entries, newMemUsed);       }       return entries;   }   return lockEntries(); } <\/code><\/pre>\n<p>  \u0412 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0446\u0438\u043a\u043b <i>while<\/i>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 <i>entries<\/i>. \u041d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043b\u0438 \u0432\u0430\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e\u0435? \u042d\u0442\u043e\u0442 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f. <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u041f\u041e \u0438\u0433\u0440\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0443\u044e \u0440\u043e\u043b\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0430 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435, \u0432\u044b \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0435 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u044b \u043d\u0430 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0433\u043b\u0443\u043f\u044b\u0445 \u0438\u043b\u0438 \u0442\u044f\u0436\u0435\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043d\u0435 \u043f\u0443\u0441\u043a\u0430\u043b\u0438\u0441\u044c \u0432 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0438\u0441\u043a\u0438 \u0431\u0430\u0433\u043e\u0432, \u0442\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0412\u0430\u043c \u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"http:\/\/www.viva64.com\/ru\/pvs-studio-download-linux\/\">PVS-Studio \u0434\u043b\u044f Linux<\/a> \u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. <\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/en\/b\/0455\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/35e\/064\/ddf\/35e064ddf91f5d99b620384893909ff7.png\" \/><\/div>\n<p><\/a><br \/>  \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 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Maxim Stefanov. <a href=\"http:\/\/www.viva64.com\/en\/b\/0455\/\">PVS-Studio for Linux Went on a Tour Around Disney<\/a>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441?<\/b><\/p>\n<div class=\"spoiler_text\">\u0427\u0430\u0441\u0442\u043e \u043a \u043d\u0430\u0448\u0438\u043c \u0441\u0442\u0430\u0442\u044c\u044f\u043c \u0437\u0430\u0434\u0430\u044e\u0442 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043d\u0438\u0445 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/www.viva64.com\/ru\/a\/0085\/\">\u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e PVS-Studio, \u0432\u0435\u0440\u0441\u0438\u044f 2015<\/a>. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c.  <\/div>\n<\/div>\n<p> \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:\/\/habrahabr.ru\/post\/315824\/\"> https:\/\/habrahabr.ru\/post\/315824\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/43b\/fc9\/0ce\/43bfc90ce2367bfe20057be2382a62ba.png\" \/><\/div>\n<\/p>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u043b\u0430 \u0432 \u0441\u0432\u0435\u0442 Linux-\u0432\u0435\u0440\u0441\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio. \u0421 \u0435\u0435 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u044b\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d \u0440\u044f\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u0421\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 Chromium, GCC, LLVM (Clang) \u0438 \u0434\u0440\u0443\u0433\u0438\u0435. \u0418 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b Walt Disney Animation Studios \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.   <\/p>\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-281330","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281330","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=281330"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281330\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}