{"id":404241,"date":"2024-06-29T17:35:32","date_gmt":"2024-06-29T17:35:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=404241"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T17:35:32","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=404241","title":{"rendered":"<span>\u0411\u0440\u0443\u0442\u0430\u043b\u044c\u043d\u044b\u0439 Protocol Buffers \u043e\u0442 Google vs \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Protocol Buffers \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439, \u043a\u0440\u0443\u0442\u043e\u0439 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 Google. \u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 PVS-Studio. \u041d\u0430\u0439\u0442\u0438 \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/eb6\/aa6\/cfb\/eb6aa6cfb4034cef04fec02749e310cd.png\" alt=\"PVS-Studio: \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c Protocol Buffers\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/eb6\/aa6\/cfb\/eb6aa6cfb4034cef04fec02749e310cd.png\"\/><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u043d\u0430\u0448 \u043c\u043d\u043e\u0433\u043e\u043b\u0435\u0442\u043d\u0438\u0439 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/inspections\/\">\u0446\u0438\u043a\u043b \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439<\/a> \u043f\u0440\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u044f \u043e\u0431\u0440\u0430\u0442\u0438\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/protocolbuffers\/protobuf\">Protocol Buffers<\/a> (protobuf). \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443 XML.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio, \u0432\u0435\u0434\u044c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Google \u0432\u0435\u0441\u044c\u043c\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e C++ \u043a\u043e\u0434\u0430. \u0412\u0437\u044f\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 &#171;<a href=\"https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/580762\/\">\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 C++<\/a>&#171;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u043e <a href=\"https:\/\/old.reddit.com\/r\/cpp\/comments\/pkru4h\/safer_usage_of_c_in_chrome\/\">\u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0441\u044f<\/a>. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e protobuf \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u043c\u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d. \u041d\u0430\u0439\u0442\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043f\u0430\u0440\u0443 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0441\u0442\u043d\u043e \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435. \u0422\u0430\u043a \u0447\u0435\u0433\u043e \u043c\u044b \u0436\u0434\u0451\u043c, \u0432\u043f\u0435\u0440\u0451\u0434!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/e5e\/7cd\/6ac\/e5e7cd6ac762b0fdaaa8581a641e6006.png\" alt=\"\u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0448\u0430\u043d\u0441\u043e\u0432 \u043d\u0430 \u0443\u0441\u043f\u0435\u0445\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e5e\/7cd\/6ac\/e5e7cd6ac762b0fdaaa8581a641e6006.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442. \u041e\u0434\u043d\u0430\u0436\u0434\u044b, \u0442\u0440\u0438 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434, \u043c\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u043b\u0438 \u0432 \u043d\u0435\u0433\u043e, \u043a\u043e\u0433\u0434\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Chromium. \u041c\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 &#171;<a href=\"https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/346128\/\">31 \u0444\u0435\u0432\u0440\u0430\u043b\u044f<\/a>&#171;.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0430 \u0437\u0430\u0434\u0443\u043c\u043a\u0430, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u0438\u0441\u0430\u043b \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e. \u042f \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u043e\u0432\u043e\u0433\u043e <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0851\/\">\u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043c\u0435\u0436\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0421++ \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/a>. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u0435\u0436\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0432\u043d\u0451\u0441. \u0427\u0442\u043e \u0441 \u043d\u0438\u043c, \u0447\u0442\u043e \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u2014 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0439\u0442\u0438 :).<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u043b\u044f\u043f\u044b \u0441\u043a\u0440\u044b\u043b\u0438\u0441\u044c \u043e\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"copy-paste\">Copy-Paste<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">void SetPrimitiveVariables(....) {   ....   if (HasHasbit(descriptor)) {     (*variables)[\"get_has_field_bit_message\"] = ....;     (*variables)[\"set_has_field_bit_message\"] = ....;     (*variables)[\"clear_has_field_bit_message\"] = ....;     ....   } else {     (*variables)[\"set_has_field_bit_message\"] = \"\";      \/\/ &lt;=     (*variables)[\"set_has_field_bit_message\"] = \"\";      \/\/ &lt;=     (*variables)[\"clear_has_field_bit_message\"] = \"\";   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/w\/v519\/\">V519<\/a> [CWE-563] The variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 163, 164. java_primitive_field_lite.cc 164<\/p>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0430\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a. \u0413\u0434\u0435-\u0442\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438, \u0433\u0434\u0435-\u0442\u043e \u043d\u0435\u0442. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f &#171;set_has_field_bit_message&#187;.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u0432\u044b\u0448\u0435, \u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432 else-\u0432\u0435\u0442\u043a\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">(*variables)[\"get_has_field_bit_message\"] = \"\"; (*variables)[\"set_has_field_bit_message\"] = \"\"; (*variables)[\"clear_has_field_bit_message\"] = \"\";<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"utechka-faylovogo-deskriptora\">\u0423\u0442\u0435\u0447\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">ExpandWildcardsResult ExpandWildcards(     const string&amp; path, std::function&lt;void(const string&amp;)> consume) {   ....   HANDLE handle = ::FindFirstFileW(wpath.c_str(), &amp;metadata);   ....   do {     \/\/ Ignore \".\", \"..\", and directories.     if ((metadata.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY) == 0 &amp;&amp;         kDot != metadata.cFileName &amp;&amp; kDotDot != metadata.cFileName) {       matched = ExpandWildcardsResult::kSuccess;       string filename;       if (!strings::wcs_to_utf8(metadata.cFileName, &amp;filename)) {         return ExpandWildcardsResult::kErrorOutputPathConversion;       \/\/ &lt;=       }     ....   } while (::FindNextFileW(handle, &amp;metadata));   FindClose(handle);   return matched; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/w\/v773\/\">V773<\/a> [CWE-401] The function was exited without releasing the &#8216;handle&#8217; handle. A resource leak is possible. io_win32.cc 400<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 <em>handle<\/em> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043a\u0440\u044b\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u043e\u0432\u0430 <em>FindClose(handle)<\/em>. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 UTF-8-encoded \u0432 UTF-8. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438 \u0432\u0435\u0440\u043d\u0451\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"potencialnoe-perepolnenie\">\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">uint32_t GetFieldOffset(const FieldDescriptor* field) const {   if (InRealOneof(field)) {     size_t offset =         static_cast&lt;size_t>(field->containing_type()->field_count() +                             field->containing_oneof()->index());     return OffsetValue(offsets_[offset], field->type());   } else {     return GetFieldOffsetNonOneof(field);   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/w\/v1028\/\">V1028<\/a> [CWE-190] Possible overflow. Consider casting operands, not the result. generated_message_reflection.h 140<\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <em>int<\/em> \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 <em>size_t<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">size_t offset = static_cast&lt;size_t>(int_var_1 + int_var_2);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0441\u0443\u043c\u043c\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u0432\u0443\u0445 32-\u0431\u0438\u0442\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>INT_MAX<\/em>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 <em>size_t<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u0432 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u043d\u0438\u043c\u0430\u044f, \u0447\u0442\u043e \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 <em>int<\/em> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041e\u043d\u043e \u043d\u0438 \u043e\u0442 \u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442. \u0418 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0431\u044b \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043e\u0442 <em>int<\/em> \u043a <em>size_t<\/em>. \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">size_t offset = int_var_1 + int_var_2;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u043e\u0431\u043a\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0435 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">size_t offset = static_cast&lt;size_t>(int_var_1) + int_var_2;<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"razymenovanie-nulevogo-ukazatelya\">\u0420\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool KotlinGenerator::Generate(....) {   ....   std::unique_ptr&lt;FileGenerator> file_generator;   if (file_options.generate_immutable_code) {     file_generator.reset(         new FileGenerator(file, file_options, \/* immutable_api = *\/ true));   }    if (!file_generator->Validate(error)) {     return false;   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/w\/v614\/\">V614<\/a> [CWE-457] Potentially null smart pointer &#8216;file_generator&#8217; used. java_kotlin_generator.cc 100<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>generate_immutable_code<\/em> \u0432\u0434\u0440\u0443\u0433 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u0430 <em>fasle<\/em>, \u0442\u043e \u0443\u043c\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>file_generator<\/em> \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u0435\u043d <em>nullptr<\/em>. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412\u0438\u0434\u0438\u043c\u043e, \u043f\u043e\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>generate_immutable_code<\/em> \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u0430, \u0440\u0430\u0437 \u044d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0435\u0449\u0451 \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430. \u0415\u0451 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0435\u0441\u0442\u044c \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043e \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e. \u0410 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0438\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043b\u0443\u0447\u0448\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u0447\u0435\u043c \u0436\u0434\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u043d\u0430 \u043d\u0435\u0439 \u043f\u043e\u0434\u043e\u0440\u0432\u0451\u0442\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u0421\u0443\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"tam-li-skobka\">\u0422\u0430\u043c \u043b\u0438 \u0441\u043a\u043e\u0431\u043a\u0430?<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">AlphaNum::AlphaNum(strings::Hex hex) {   char *const end = &amp;digits[kFastToBufferSize];   char *writer = end;   uint64 value = hex.value;   uint64 width = hex.spec;   \/\/ We accomplish minimum width by OR'ing in 0x10000 to the user's value,   \/\/ where 0x10000 is the smallest hex number that is as wide as the user   \/\/ asked for.   uint64 mask = ((static_cast&lt;uint64>(1) &lt;&lt; (width - 1) * 4)) | value;   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u043e\u0434\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">((static_cast&lt;uint64>(1) &lt;&lt; (width - 1) * 4))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e 2 \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v634\/\">V634<\/a> [CWE-783] The priority of the &#8216;*&#8217; operation is higher than that of the &#8216;&lt;&lt;&#8216; operation. It&#8217;s possible that parentheses should be used in the expression. strutil.cc 1408<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v592\/\">V592<\/a> The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present. strutil.cc 1408<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430. \u0415\u0441\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0434\u0432\u0438\u0433\u0430 \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f. \u041b\u0435\u0433\u043a\u043e \u0437\u0430\u0431\u044b\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0435\u043d. \u0410 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0441\u043a\u043e\u0431\u043e\u0447\u043a\u0438 \u043d\u0430\u043c\u0435\u043a\u0430\u044e\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e \u044d\u0442\u0443 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u043b\u0438 \u0438 \u0445\u043e\u0442\u0435\u043b\u0438 \u0435\u0451 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c. \u041d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. \u041f\u0435\u0440\u0432\u044b\u0439: \u043a\u043e\u0434 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043f\u0440\u043e\u0449\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430, \u043d\u043e \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">uint64 mask = (static_cast&lt;uint64>(1) &lt;&lt; ((width - 1) * 4)) | value;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439: \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439. \u0422\u043e\u0433\u0434\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">uint64 mask = ((static_cast&lt;uint64>(1) &lt;&lt; (width - 1)) * 4) | value;<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u0442\u0430\u043a\u043e\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430 :). \u0421\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u0443 \u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430, \u0435\u0441\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043f\u0430\u0440\u0430 \u043e\u0448\u0438\u0431\u043e\u043a :).<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/925\/4f8\/905\/9254f8905c48ad9935581416a2739d05.png\" alt=\"PVS-Studio \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043e\u043d \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/925\/4f8\/905\/9254f8905c48ad9935581416a2739d05.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442 \u043f\u0440\u0438 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0639\/\">\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438<\/a> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u0435\u0436\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0430 \u043d\u0435 \u043f\u0440\u0438 \u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u0445 \u0443\u0436\u0435 \u043e\u0442\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0443\u0436\u043d\u043e \u0441 \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0430\u0447\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e <a href=\"https:\/\/pvs-studio.com\/ru\/pvs-studio\/try-free\/\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c PVS-Studio<\/a>, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u0430\u043c\u044b\u0435 <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/manual\/6532\/\">\u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f<\/a>. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043c\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e :).<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u0430\u0448 \u043a\u043e\u0434 \u0441\u0442\u043e\u043b\u044c \u0436\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439, \u043a\u0430\u043a protobuf, \u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c PVS-Studio \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. \u041a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043e\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/0743\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Andrey Karpov. <a href=\"https:\/\/habr.com\/en\/company\/pvs-studio\/blog\/587478\/\">Protocol Buffers, a brutal protocol from Google, vs. PVS-Studio, a static code analyzer<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/587486\/\"> https:\/\/habr.com\/ru\/articles\/587486\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Protocol Buffers \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439, \u043a\u0440\u0443\u0442\u043e\u0439 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439 Google. \u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 PVS-Studio. \u041d\u0430\u0439\u0442\u0438 \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/eb6\/aa6\/cfb\/eb6aa6cfb4034cef04fec02749e310cd.png\" alt=\"PVS-Studio: \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c Protocol Buffers\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/eb6\/aa6\/cfb\/eb6aa6cfb4034cef04fec02749e310cd.png\"\/><\/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-404241","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/404241","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=404241"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/404241\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=404241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=404241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=404241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}