{"id":315091,"date":"2020-12-18T09:00:53","date_gmt":"2020-12-18T09:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=315091"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=315091","title":{"rendered":"\u0422\u043e\u043f 10 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 C++ \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0437\u0430 2020 \u0433\u043e\u0434"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ed\/qz\/kt\/edqzktmzcrowmhowiz0-csjx1hy.png\" alt=\"image1.png\"><\/div>\n<p>  \u0417\u0430 \u043e\u043a\u043d\u043e\u043c \u0437\u0438\u043c\u0430, \u0433\u043e\u0434 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c PVS-Studio \u0432 2020 \u0433\u043e\u0434\u0443.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u0433\u043e\u0434 \u043e\u0437\u043d\u0430\u043c\u0435\u043d\u043e\u0432\u0430\u043b\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u043e\u0432\u044b\u0445 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b, \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u0438 \u0438\u043c \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u043e\u043f. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u044f\u0434\u0440\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/www.viva64.com\/ru\/b\">\u0431\u043b\u043e\u0433\u0435<\/a>. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430\u0448\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u044f\u0437\u044b\u043a\u0438 (C, C# \u0438 Java), \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0438\u0445 \u043a\u043e\u043b\u043b\u0435\u0433. \u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0441\u0430\u043c\u044b\u043c \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0432\u0448\u0438\u043c\u0441\u044f \u043c\u043d\u0435 \u0431\u0430\u0433\u0430\u043c, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u043c PVS-Studio \u0437\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u0433\u043e\u0434.<\/p>\n<h2>\u0414\u0435\u0441\u044f\u0442\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443<\/h2>\n<p>  <a href=\"https:\/\/www.viva64.com\/ru\/w\/v1063\/\">V1063<\/a> The modulo by 1 operation is meaningless. The result will always be zero. llvm-stress.cpp 631<\/p>\n<pre><code class=\"cpp\">void Act() override {   ....   \/\/ If the value type is a vector, and we allow vector select,   \/\/ then in 50% of the cases generate a vector select.   if (isa&lt;FixedVectorType&gt;(Val0-&gt;getType()) &amp;&amp; (getRandom() % 1)) {     unsigned NumElem =         cast&lt;FixedVectorType&gt;(Val0-&gt;getType())-&gt;getNumElements();     CondTy = FixedVectorType::get(CondTy, NumElem);   }   .... }<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 0 \u0434\u043e 1, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0430 <i>X%1<\/i> \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0435\u0440\u043d\u0451\u0442 0. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <\/p>\n<pre><code class=\"cpp\">if (isa&lt;FixedVectorType&gt;(Val0-&gt;getType()) &amp;&amp; (getRandom() % 2))<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0771\/\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 Clang 11 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio<\/a>&quot;.<\/p>\n<h2>\u0414\u0435\u0432\u044f\u0442\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u0427\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/h2>\n<p>  \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 PVS-Studio \u0432\u044b\u0434\u0430\u043b \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.viva64.com\/ru\/w\/v560\/\">V560<\/a> A part of conditional expression is always true: x &gt;= 0. editor.cpp 1137<\/li>\n<li><a href=\"https:\/\/www.viva64.com\/ru\/w\/v560\/\">V560<\/a> A part of conditional expression is always true: y &gt;= 0. editor.cpp 1137<\/li>\n<li><a href=\"https:\/\/www.viva64.com\/ru\/w\/v560\/\">V560<\/a> A part of conditional expression is always true: x &lt; 40. editor.cpp 1137<\/li>\n<li><a href=\"https:\/\/www.viva64.com\/ru\/w\/v560\/\">V560<\/a> A part of conditional expression is always true: y &lt; 30. editor.cpp 1137<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"cpp\">int editorclass::at( int x, int y ) {   if(x&lt;0) return at(0,y);   if(y&lt;0) return at(x,0);   if(x&gt;=40) return at(39,y);   if(y&gt;=30) return at(x,29);    if(x&gt;=0 &amp;&amp; y&gt;=0 &amp;&amp; x&lt;40 &amp;&amp; y&lt;30)   {       return contents[x+(levx*40)+vmult[y+(levy*30)]];   }   return 0; }<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 <i>if<\/i>-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043d\u0451\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <i>true<\/i>. \u041d\u0435 \u0441\u043a\u0430\u0437\u0430\u043b \u0431\u044b, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0431\u0430\u0432\u043d\u043e. \u0412 \u043e\u0431\u0449\u0435\u043c, \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>  \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0707\/\">VVVVVV??? VVVVVV!!!<\/a>&quot;.<\/p>\n<h2>\u0412\u043e\u0441\u044c\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: delete \u0432\u043c\u0435\u0441\u0442\u043e delete[]<\/h2>\n<p>  <a href=\"https:\/\/www.viva64.com\/ru\/w\/v611\/\">V611<\/a> The memory was allocated using &#39;new T[]&#39; operator but was released using the &#39;delete&#39; operator. Consider inspecting this code. It&#39;s probably better to use &#39;delete [] poke_data;&#39;. CCDDE.CPP 410<\/p>\n<pre><code class=\"cpp\">BOOL Send_Data_To_DDE_Server (char *data, int length, int packet_type) {   ....   char *poke_data = new char [length + 2*sizeof(int)]; \/\/ &lt;=   ....   if(DDE_Class-&gt;Poke_Server( .... ) == FALSE) {     CCDebugString(&quot;C&amp;C95 - POKE failed!\\n&quot;);     DDE_Class-&gt;Close_Poke_Connection();     delete poke_data;                                  \/\/ &lt;=     return (FALSE);   }    DDE_Class-&gt;Close_Poke_Connection();    delete poke_data;                                    \/\/ &lt;=    return (TRUE); }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043e\u0448\u0438\u0431\u043a\u0443, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430 \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0430 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0414\u043b\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>delete[]<\/i>, \u0430 \u043d\u0435 <i>delete<\/i>.<\/p>\n<p>  \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0748\/\">\u041a\u043e\u0434 \u0438\u0433\u0440\u044b Command &amp; Conquer: \u0431\u0430\u0433\u0438 \u0438\u0437 90-\u0445. \u0422\u043e\u043c \u0432\u0442\u043e\u0440\u043e\u0439<\/a>&quot;.<\/p>\n<h2>\u0421\u0435\u0434\u044c\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u0412\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0431\u0443\u0444\u0435\u0440\u0430<\/h2>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <i>net_hostname_get<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<pre><code class=\"cpp\">#if defined(CONFIG_NET_HOSTNAME_ENABLE) const char *net_hostname_get(void); #else static inline const char *net_hostname_get(void) {   return &quot;zephyr&quot;; } #endif<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0439\u0441\u044f \u043a \u0432\u0435\u0442\u043a\u0435 <i>#else<\/i>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0432 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">static inline const char *net_hostname_get(void) {   return &quot;zephyr&quot;; }<\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 7 \u0431\u0430\u0439\u0442 (\u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a\u0438).<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434, \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0439 \u043a \u0432\u044b\u0445\u043e\u0434\u0443 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<pre><code class=\"cpp\">static int do_net_init(void) {   ....   (void)memcpy(hostname, net_hostname_get(), MAX_HOSTNAME_LEN);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/www.viva64.com\/ru\/w\/v512\/\">V512<\/a> [CWE-119] A call of the &#39;memcpy&#39; function will lead to the &#39;net_hostname_get()&#39; buffer becoming out of range. log_backend_net.c 114<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <i>MAX_HOSTNAME_LEN<\/i> \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">(void)memcpy(hostname, net_hostname_get(),     sizeof(&quot;xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx&quot;));<\/code><\/pre>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430. \u041a\u0430\u043a \u044d\u0442\u043e \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e. <\/p>\n<p>  \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0721\/\">\u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Zephyr<\/a>&quot;.<\/p>\n<h2>\u0428\u0435\u0441\u0442\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u0427\u0442\u043e-\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">static char *mntpt_prepare(char *mntpt) {   char *cpy_mntpt;    cpy_mntpt = k_malloc(strlen(mntpt) + 1);   if (cpy_mntpt) {     ((u8_t *)mntpt)[strlen(mntpt)] = &#39;\\0&#39;;     memcpy(cpy_mntpt, mntpt, strlen(mntpt));   }   return cpy_mntpt; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/www.viva64.com\/ru\/w\/v575\/\">V575<\/a> [CWE-628] The &#39;memcpy&#39; function doesn&#39;t copy the whole string. Use &#39;strcpy \/ strcpy_s&#39; function to preserve terminal null. shell.c 427<\/p>\n<p>  \u041a\u0442\u043e-\u0442\u043e \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>strdup<\/i>, \u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \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. \u041e\u043d \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>memcpy<\/i> \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u043d\u043e \u043d\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c, \u0438 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 0 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c:<\/p>\n<pre><code class=\"cpp\">((u8_t *)mntpt)[strlen(mntpt)] = &#39;\\0&#39;;<\/code><\/pre>\n<p>  \u041d\u043e \u043d\u0435\u0442! \u0417\u0434\u0435\u0441\u044c \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c \u0432 \u0441\u0435\u0431\u044f! \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <i>mntpt<\/i>, \u0430 \u043d\u0435 \u0432 <i>cpy_mntpt<\/i>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>mntpt_prepare<\/i> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443, \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0443\u044e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0443\u043b\u0451\u043c.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0445\u043e\u0442\u0435\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">((u8_t *)cpy_mntpt)[strlen(mntpt)] = &#39;\\0&#39;;<\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0437\u0430\u0447\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0442\u0430\u043a \u0441\u043b\u043e\u0436\u043d\u043e! \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<pre><code class=\"cpp\">static char *mntpt_prepare(char *mntpt) {   char *cpy_mntpt;    cpy_mntpt = k_malloc(strlen(mntpt) + 1);   if (cpy_mntpt) {     strcpy(cpy_mntpt, mntpt);   }   return cpy_mntpt; }<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0721\/\">\u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Zephyr<\/a>&quot;.<\/p>\n<h2>\u041f\u044f\u0442\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/h2>\n<p>  <a href=\"https:\/\/www.viva64.com\/ru\/w\/v547\/\">V547<\/a> [CWE-570] Expression &#39;rel_wait &lt; 0&#39; is always false. Unsigned type value is never &lt; 0. os_thread_windows.c 359<\/p>\n<pre><code class=\"cpp\">static DWORD get_rel_wait(const struct timespec *abstime) {   struct __timeb64 t;   _ftime64_s(&amp;t);   time_t now_ms = t.time * 1000 + t.millitm;   time_t ms = (time_t)(abstime-&gt;tv_sec * 1000 +     abstime-&gt;tv_nsec \/ 1000000);    DWORD rel_wait = (DWORD)(ms - now_ms);    return rel_wait &lt; 0 ? 0 : rel_wait; }<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>rel_wait<\/i> \u0438\u043c\u0435\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f <i>DWORD<\/i>. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 <i>rel_wait &lt; 0<\/i> \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u0438\u043d\u0430.<\/p>\n<p>  \u0421\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f. \u0417\u0430\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0432\u044b\u0448\u043b\u043e \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u0435\u0451 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438, \u0430 \u043b\u0438\u0448\u044c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u043a\u043e\u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0776\/\">\u041f\u043e\u0447\u0435\u043c\u0443 PVS-Studio \u043d\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u0434\u0430<\/a>&quot;.<\/p>\n<p>  \u041e\u0448\u0438\u0431\u043a\u0430 \u0436\u0435 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0756\/\">\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a PMDK \u043e\u0442 Intel \u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<\/a>&quot;.<\/p>\n<h2>\u0427\u0435\u0442\u0432\u0451\u0440\u0442\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u041d\u0435 \u043f\u0438\u0448\u0438 \u0432 std, \u0431\u0440\u0430\u0442<\/h2>\n<p>  <a href=\"https:\/\/www.viva64.com\/ru\/w\/v1061\/\">V1061<\/a> Extending the &#39;std&#39; namespace may result in undefined behavior. sized_iterator.hh 210<\/p>\n<pre><code class=\"cpp\">\/\/ Dirty hack because g++ 4.6 at least wants \/\/ to do a bunch of copy operations. namespace std { inline void iter_swap(util::SizedIterator first,                       util::SizedIterator second) {   util::swap(*first, *second); } } \/\/ namespace std<\/code><\/pre>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0437\u044f\u0442\u043e \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0768\/\">\u0410\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 DeepSpeech \u0438\u043b\u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 namespace std<\/a>&quot; \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<h2>\u0422\u0440\u0435\u0442\u044c\u0435 \u043c\u0435\u0441\u0442\u043e: \u0421\u043a\u0440\u043e\u043b\u043b\u0431\u0430\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0441\u043c\u043e\u0433<\/h2>\n<p>  <b><a href=\"https:\/\/www.viva64.com\/ru\/w\/v501\/\">V501<\/a><\/b>. There are identical sub-expressions to the left and to the right of the &#39;-&#39; operator: bufferHeight \u2014 bufferHeight TermControl.cpp 592<\/p>\n<pre><code class=\"cpp\">bool TermControl::_InitializeTerminal() {   ....   auto bottom = _terminal-&gt;GetViewport().BottomExclusive();   auto bufferHeight = bottom;    ScrollBar().Maximum(bufferHeight - bufferHeight);   ScrollBar().Minimum(0);   ScrollBar().Value(0);   ScrollBar().ViewportSize(bufferHeight);   .... }<\/code><\/pre>\n<p>  \u042d\u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, &quot;\u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0441 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439&quot;. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441\u043a\u0440\u043e\u043b\u043b\u0431\u0430\u0440 \u0432 Windows Terminal. \u041f\u043e \u043c\u043e\u0442\u0438\u0432\u0430\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0433\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0446\u0435\u043b\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u043f\u0440\u043e\u0432\u0451\u043b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0441\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0438\u0441\u044c? \u0412\u043e\u0442 \u043e\u043d\u0430: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0718\/\">\u0421\u043a\u0440\u043e\u043b\u043b\u0431\u0430\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0441\u043c\u043e\u0433<\/a>&quot;.<\/p>\n<h2>\u0412\u0442\u043e\u0440\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u043f\u0435\u0440\u0435\u043f\u0443\u0442\u0430\u043b\u0438 \u0440\u0430\u0434\u0438\u0443\u0441 \u0438 \u0432\u044b\u0441\u043e\u0442\u0443<\/h2>\n<p>  \u0418 \u043e\u043f\u044f\u0442\u044c \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.viva64.com\/ru\/w\/v764\/\">V764<\/a> Possible incorrect order of arguments passed to &#39;CreateWheel&#39; function: &#39;height&#39; and &#39;radius&#39;. StandardJoints.cpp 791<\/li>\n<li><a href=\"https:\/\/www.viva64.com\/ru\/w\/v764\/\">V764<\/a> Possible incorrect order of arguments passed to &#39;CreateWheel&#39; function: &#39;height&#39; and &#39;radius&#39;. StandardJoints.cpp 833<\/li>\n<li><a href=\"https:\/\/www.viva64.com\/ru\/w\/v764\/\">V764<\/a> Possible incorrect order of arguments passed to &#39;CreateWheel&#39; function: &#39;height&#39; and &#39;radius&#39;. StandardJoints.cpp 884<\/li>\n<\/ul>\n<p>  \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cpp\">NewtonBody* const wheel = CreateWheel (scene, origin, height, radius);<\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0435\u0451 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cpp\">static NewtonBody* CreateWheel (DemoEntityManager* const scene,   const dVector&amp; location, dFloat radius, dFloat height)<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0443\u0442\u0430\u043d\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438.<\/p>\n<p>  \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0729\/\">\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 Newton Game Dynamics \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c PVS-Studio<\/a>&quot;.<\/p>\n<h2>\u041f\u0435\u0440\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e: \u0417\u0430\u0442\u0438\u0440\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430<\/h2>\n<p>  <a href=\"https:\/\/www.viva64.com\/ru\/w\/v519\/\">V519<\/a> The &#39;color_name&#39; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 621, 627. string.cpp 627<\/p>\n<pre><code class=\"cpp\">static bool parseNamedColorString(const std::string &amp;value,                                   video::SColor &amp;color) {   std::string color_name;   std::string alpha_string;    size_t alpha_pos = value.find(&#39;#&#39;);   if (alpha_pos != std::string::npos) {     color_name = value.substr(0, alpha_pos);     alpha_string = value.substr(alpha_pos + 1);   } else {     color_name = value;   }    color_name = lowercase(value); \/\/ &lt;=    std::map&lt;const std::string, unsigned&gt;::const_iterator it;   it = named_colors.colors.find(color_name);   if (it == named_colors.colors.end())     return false;   .... }<\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0430\u0437\u0431\u043e\u0440 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <i>color_name<\/i> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u043b\u0438\u0431\u043e \u043a\u043e\u043f\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0437\u0430\u0442\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>lowercase()<\/i> \u0432 \u043d\u0438\u0436\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u0441\u0430\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u043c \u0446\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <i>parseNamedColorString()<\/i>.<\/p>\n<pre><code class=\"cpp\">color_name = lowercase(color_name);<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0448\u043b\u0430 \u0432 \u0442\u043e\u043f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0751\/\">PVS-Studio: \u0410\u043d\u0430\u043b\u0438\u0437 pull request-\u043e\u0432 \u0432 Azure DevOps \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 self-hosted \u0430\u0433\u0435\u043d\u0442\u043e\u0432<\/a>&quot;.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0417\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u0433\u043e\u0434 \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0432 open source \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u042d\u0442\u043e \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 copy-paste, \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u0445, \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041d\u0430\u0448 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0438 \u0432 \u0442\u043e\u043f\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u043d\u043e\u0432\u044b\u0445 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0434\u0443.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u041b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u043e\u043d\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438. \u041d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0430\u0448\u0435 \u0432\u0438\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043c\u043e\u0435\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439 &quot;T\u043e\u043f 10&#8230;&quot;, \u043f\u043e\u0447\u0438\u0442\u0430\u0432 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e <a href=\"https:\/\/www.viva64.com\/ru\/b\/\">\u0431\u043b\u043e\u0433\u0430<\/a> \u0438\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 PVS-Studio \u0432 open source \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 \u0442\u043e\u043f 10 C++ \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u043b\u0435\u0442: <a href=\"https:\/\/www.viva64.com\/ru\/b\/0483\/\">2016<\/a>, <a href=\"https:\/\/www.viva64.com\/ru\/b\/0565\/\">2017<\/a>, <a href=\"https:\/\/www.viva64.com\/ru\/b\/0619\/\">2018<\/a>, <a href=\"https:\/\/www.viva64.com\/ru\/b\/0700\/\">2019<\/a>.<\/p>\n<p>  <a href=\"https:\/\/habr.com\/en\/company\/pvs-studio\/blog\/533694\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d5\/1k\/2e\/d51k2edrgxyrg5voswox_46pg3o.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: Vladislav Stolyarov. <a href=\"https:\/\/habr.com\/en\/company\/pvs-studio\/blog\/533694\/\">Top 10 Bugs Found in C++ Projects in 2020<\/a>.<\/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:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/533696\/\"> https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/533696\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ed\/qz\/kt\/edqzktmzcrowmhowiz0-csjx1hy.png\" alt=\"image1.png\"><\/div>\n<p>  \u0417\u0430 \u043e\u043a\u043d\u043e\u043c \u0437\u0438\u043c\u0430, \u0433\u043e\u0434 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c PVS-Studio \u0432 2020 \u0433\u043e\u0434\u0443.  <\/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-315091","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315091","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=315091"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315091\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}