{"id":213969,"date":"2014-02-26T14:23:05","date_gmt":"2014-02-26T10:23:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=213969"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=213969","title":{"rendered":"<span class=\"post_title\">\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 glibc<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ff2\/600\/1c0\/ff26001c02cc1841ad22c1b9549cac18.png\" alt=\"glibc and PVS-Studio\" align=\"left\"\/> <br \/>  \u041c\u044b \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 glibc \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio. \u0426\u0435\u043b\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c Linux-\u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u041f\u043e\u043a\u0430 \u043f\u043b\u043e\u0445\u043e \u043c\u043e\u0436\u0435\u0442. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u0438\u0437-\u0437\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e, \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0435 \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>glibc<\/h2>\n<p>  <b><i>glibc<\/i><\/b><i> \u2014 GNU C Library (GNU \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430). Glibc \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0421\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a open, malloc, printf \u0438 \u0442.\u0434. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 C \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0430\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u041e\u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 Free Software Foundation \u0434\u043b\u044f GNU \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. glibc \u0432\u044b\u043f\u0443\u0449\u0435\u043d\u0430 \u043f\u043e\u0434 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 GNU LGPL.<\/i> <\/p>\n<p>  <i>\u0412\u0437\u044f\u0442\u043e \u0438\u0437 Wikipedia: <a href=\"http:\/\/www.viva64.com\/go.php?url=1353\"><i>glibc<\/i><\/a>.<\/i><\/p>\n<p>  \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0432\u044b\u0448\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 glibc. \u042d\u0442\u043e \u043f\u043e\u0434\u0432\u0438\u0433\u043b\u043e \u043d\u0430\u0441 \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 <a href=\"http:\/\/www.viva64.com\/ru\/pvs-studio\/\">PVS-Studio<\/a>. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f glibc-2-19-90. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0430 \u043f\u0430\u0440\u0443 \u043d\u0435\u0434\u0435\u043b\u044c \u044f \u043e\u0442\u0432\u043b\u0435\u043a\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0448\u0451\u043b \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441. \u042f \u0431\u044b\u043b \u0437\u0430\u043d\u044f\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0430\u044f \u0434\u043b\u044f \u043d\u0430\u0441 \u0437\u0430\u0434\u0430\u0447\u0430 \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u044e\u0442 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c, \u0447\u0435\u043c \u043c\u044b \u043b\u0443\u0447\u0448\u0435 Cppcheck \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0432 Visual Studio 2013. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 glibc \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c.<\/p>\n<p>  \u041d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0443\u0436\u0430\u0441\u043d\u043e\u0435 \u043c\u044b \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u043d\u0430\u0448\u043b\u0438. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 glibc \u043e\u0447\u0435\u043d\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u0430\u044f \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438. \u041a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u044d\u0442\u043e:<\/p>\n<ul>\n<li>Coverity;<\/li>\n<li>Clang;<\/li>\n<li>Cppcheck.<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e, \u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u0412 \u0447\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430<\/h2>\n<p>  \u041d\u0435\u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c \u0441 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043a\u0443\u0445\u043d\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043e\u043d\u0438 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c\u0438. \u042d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u0421 \u0442\u043e\u043b\u043a\u0443 \u043c\u043e\u0433\u0443\u0442 \u0441\u0431\u0438\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u0430\u043a <a href=\"http:\/\/www.viva64.com\/go.php?url=1354\">RATS<\/a>. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043a\u043e\u0434 RATS, \u0442\u043e \u0432\u0438\u0434\u0435\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0438\u0441\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0438\u043c\u0451\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445. \u042d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0442\u043e\u0436\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u043a\u043e\u0434\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u043b\u0451\u043a \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0435\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043a\u043e\u0434\u0430. \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, \u044d\u0442\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043f\u043e\u0438\u0441\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 [<a href=\"http:\/\/www.viva64.com\/ru\/b\/0087\/\">1<\/a>].<\/p>\n<p>  \u041d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u043b\u0438, \u0447\u0442\u043e Linux-\u0432\u0435\u0440\u0441\u0438\u044f, \u044d\u0442\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c [<a href=\"http:\/\/www.viva64.com\/ru\/b\/0231\/\">2<\/a>]. \u041c\u0435\u0436\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c \u043b\u0435\u0436\u0438\u0442 \u043f\u0440\u043e\u043f\u0430\u0441\u0442\u044c. \u041e\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435.<\/p>\n<p>  \u0427\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435, \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u043c\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0412\u043e\u0442 \u043e\u0442 \u0432\u0438\u0434\u0438\u0442, \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 strcmp():  <\/p>\n<pre><code class=\"cpp\">cmpres = strcmp (newp-&gt;from_string, root-&gt;from_string);<\/code><\/pre>\n<p>  \u0418 \u043e\u043d \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u0442, \u0432 \u043a\u0430\u043a\u043e\u0439 \u0443\u0436\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043a\u0430\u043a\u0438\u0435 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b. \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e:  <\/p>\n<pre><code class=\"cpp\">cmpres = __extension__ ({ size_t __s1_len, __s2_len;   (__builtin_constant_p (newp-&gt;from_string) &amp;&amp;   __builtin_constant_p (root-&gt;from_string) &amp;&amp;   (__s1_len = strlen (newp-&gt;from_string),   __s2_len = strlen (root-&gt;from_string),   (!((size_t)(const void *)((newp-&gt;from_string) + 1) -   (size_t)(const void *)(newp-&gt;from_string) == 1) ||   __s1_len &gt;= 4) &amp;&amp;   (!((size_t)(const void *)((root-&gt;from_string) + 1) -   (size_t)(const void *)(root-&gt;from_string) == 1) ||   __s2_len &gt;= 4)) ?   __builtin_strcmp (newp-&gt;from_string, root-&gt;from_string) :   (__builtin_constant_p (newp-&gt;from_string) &amp;&amp;   ((size_t)(const void *)((newp-&gt;from_string) + 1) -   (size_t)(const void *)(newp-&gt;from_string) == 1) &amp;&amp;   (__s1_len = strlen (newp-&gt;from_string), __s1_len &lt; 4) ?   (__builtin_constant_p (root-&gt;from_string) &amp;&amp;   ((size_t)(const void *)((root-&gt;from_string) + 1) -   (size_t)(const void *)(root-&gt;from_string) == 1) ?    __builtin_strcmp (newp-&gt;from_string, root-&gt;from_string) :   (__extension__ ({ const unsigned char *__s2 =   (const unsigned char *) (const char *) (root-&gt;from_string);   int __result = (((const unsigned char *) (const char *)   (newp-&gt;from_string))[0] - __s2[0]);   if (__s1_len &gt; 0 &amp;&amp; __result == 0) {   __result = (((const unsigned char *) (const char *)   (newp-&gt;from_string))[1] - __s2[1]);   if (__s1_len &gt; 1 &amp;&amp; __result == 0) { __result =   (((const unsigned char *) (const char *)   (newp-&gt;from_string))[2] - __s2[2]);   if (__s1_len &gt; 2 &amp;&amp; __result == 0)   __result = (((const unsigned char *)   (const char *) (newp-&gt;from_string))[3] -   __s2[3]); } } __result; }))) :   (__builtin_constant_p (root-&gt;from_string) &amp;&amp;   ((size_t)(const void *)((root-&gt;from_string) + 1) -   (size_t)(const void *)(root-&gt;from_string) == 1) &amp;&amp;   (__s2_len = strlen (root-&gt;from_string), __s2_len &lt; 4) ?   (__builtin_constant_p (newp-&gt;from_string) &amp;&amp;   ((size_t)(const void *)((newp-&gt;from_string) + 1) -   (size_t)(const void *)(newp-&gt;from_string) == 1) ?   __builtin_strcmp (newp-&gt;from_string, root-&gt;from_string) :   (- (__extension__ ({ const unsigned char *__s2 =   (const unsigned char *) (const char *) (newp-&gt;from_string);   int __result = (((const unsigned char *) (const char *)   (root-&gt;from_string))[0] - __s2[0]);   if (__s2_len &gt; 0 &amp;&amp; __result == 0) { __result =   (((const unsigned char *) (const char *)   (root-&gt;from_string))[1] - __s2[1]);   if (__s2_len &gt; 1 &amp;&amp; __result == 0)   { __result = (((const unsigned char *)   (const char *) (root-&gt;from_string))[2] -   __s2[2]); if (__s2_len &gt; 2 &amp;&amp; __result == 0)   __result = (((const unsigned char *) (const char *)   (root-&gt;from_string))[3] - __s2[3]); } } __result; })))) :   __builtin_strcmp (newp-&gt;from_string, root-&gt;from_string)))); });<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432 \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u0451\u0442 \u043d\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u0445 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041f\u043e\u044f\u0441\u043d\u044e \u043f\u0440\u043e \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"cpp\">assert(MAP_FAILED == (void *) -1);<\/code><\/pre>\n<p>  \u041c\u0430\u043a\u0440\u043e\u0441 assert() \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">((((void *) -1) == (void *) -1) ? (void) (0) :   __assert_fail (&quot;((void *) -1) == (void *) -1&quot;,     &quot;loadmsgcat.c&quot;, 840, __PRETTY_FUNCTION__));<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0432\u044b\u0434\u0430\u0451\u0442 \u043b\u043e\u0436\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (((void *) -1) == (void *) -1):<\/p>\n<p>  <i>V501 There are identical sub-expressions to the left and to the right of the &#8216;==&#8217; operator: ((void *) \u2014 1) == (void *) \u2014 1 loadmsgcat.c 840<\/i><\/p>\n<p>  \u041c\u044b \u043d\u0435 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u044b \u044d\u0442\u043e\u043c\u0443. \u0412\u0441\u0451 \u044d\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438, \u0432\u0435\u0434\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Visual C++. \u0422\u0430\u043c \u0442\u043e\u0436\u0435 \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u044f\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0438 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0442\u043e. \u041d\u0443\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u043e \u0441 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u043c \u00abassert\u00bb \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u0435\u043d \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0447\u0442\u043e \u043c\u0430\u043a\u0440\u043e\u0441 MAP_FAILED \u0440\u0430\u0432\u0435\u043d &quot;(void *) -1&quot;. \u0412\u0441\u0451 \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f Visual C++. \u0410 \u0434\u043b\u044f Linux \u043d\u0435\u0442.<\/p>\n<p>  \u0412 \u0443\u043c\u0435\u043d\u0438\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0412\u043d\u0435\u0448\u043d\u0435 \u044d\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0435 \u0432\u0438\u0434\u043d\u0430. \u041d\u043e \u043e\u043d \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u042d\u0442\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0434\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044f \u043f\u0440\u0438\u043e\u0442\u043a\u0440\u044b\u043b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u0449\u0435\u043b\u043e\u0447\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u0430\u0434. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u044f\u0434 \u0441\u0442\u0430\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0436\u0443\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0414\u0443\u043c\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<h2>\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430<\/h2>\n<p>  \u0425\u043e\u0442\u044f \u043f\u0440\u043e\u0435\u043a\u0442 glibc \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u043a\u043e\u0435 \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u044d\u0442\u0438 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u0421\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">char *DCIGETTEXT (....) {   ....   \/* Make CATEGORYVALUE point to the next element of the list. *\/   while (categoryvalue[0] != '\\0' &amp;&amp; categoryvalue[0] == ':')     ++categoryvalue;   .... }<\/code><\/pre>\n<p>  V590 Consider inspecting this expression. The expression is excessive or contains a misprint. dcigettext.c 582<\/p>\n<p>  \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0434\u043e:   <\/p>\n<pre><code class=\"cpp\">while (categoryvalue[0] == ':')<\/code><\/pre>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f (categoryvalue[0] != &#8216;\\0&#8217;) \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u0438\u0448\u043d\u044f\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u0432\u0434\u0440\u0443\u0433 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">while (categoryvalue[0] != '\\0' &amp;&amp; categoryvalue[0] != ':')<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0420\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/h3>\n<p>  \u041d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u044d\u0442\u043e \u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0430\u0441\u043d\u043e. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e. \u041d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435:  <\/p>\n<pre><code class=\"cpp\">static enum clnt_stat clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout)      CLIENT *h;      u_long proc;      xdrproc_t xargs;      caddr_t argsp;      xdrproc_t xresults;      caddr_t resultsp;      struct timeval timeout; {   struct clntraw_private_s *clp = clntraw_private;   XDR *xdrs = &amp;clp-&gt;xdr_stream;   ....   if (clp == NULL)     return RPC_FAILED;   .... }<\/code><\/pre>\n<p>  V595 The &#8216;clp&#8217; pointer was utilized before it was verified against nullptr. Check lines: 145, 150. clnt_raw.c 145<\/p>\n<p>  \u0420\u044f\u0434\u043e\u043c \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0434\u0435\u0444\u0435\u043a\u0442: V595 The &#8216;clp&#8217; pointer was utilized before it was verified against nullptr. Check lines: 232, 235. clnt_raw.c 232<\/p>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"cpp\">int __nss_getent_r (....) {   ....   if (res &amp;&amp; __res_maybe_init (&amp;_res, 0) == -1)   {     *h_errnop = NETDB_INTERNAL;     *result = NULL;     return errno;   }   ....   if (status == NSS_STATUS_TRYAGAIN       &amp;&amp; (h_errnop == NULL || *h_errnop == NETDB_INTERNAL)       &amp;&amp; errno == ERANGE) }<\/code><\/pre>\n<p>  V595 The &#8216;h_errnop&#8217; pointer was utilized before it was verified against nullptr. Check lines: 146, 172. getnssent_r.c 146<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 if (res &amp;&amp; __res_maybe_init (&amp;_res, 0) == -1), \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d\u0430 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 &#8216;h_errnop&#8217; \u0438 &#8216;result&#8217;. \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u044b NULL. \u042d\u0442\u043e\u0442 \u0432\u044b\u0432\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044f \u043a\u043e\u0434 \u043d\u0438\u0436\u0435.<\/p>\n<h3>\u041e\u043f\u0430\u0441\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f (\u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c)<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">char * __sha256_crypt_r (key, salt, buffer, buflen)      const char *key;      const char *salt;      char *buffer;      int buflen; {   ....   unsigned char temp_result[32]   ....   memset (temp_result, '\\0', sizeof (temp_result));   ....   .... \/\/ temp_result \u0434\u0430\u043b\u0435\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f }<\/code><\/pre>\n<p>  V597 The compiler could delete the &#8216;memset&#8217; function call, which is used to flush &#8216;temp_result&#8217; buffer. The RtlSecureZeroMemory() function should be used to erase the private data. sha256-crypt.c 385<\/p>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u043f\u0440\u0430\u0432\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 memset() \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 Release \u0432\u0435\u0440\u0441\u0438\u0438. \u0422\u043e\u0447\u043d\u0435\u0435 \u043e\u043d \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u0430\u0432\u0435, \u043d\u043e \u0438 \u043e\u0431\u044f\u0437\u0430\u043d \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0446\u0435\u043b\u044c\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0411\u0443\u0444\u0435\u0440 &#8216;temp_result&#8217; \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 memset() \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u0441\u0430\u043c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u043b\u0438\u0448\u043d\u0438\u0439.<\/p>\n<p>  \u041c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0447\u0438\u0449\u0435\u043d\u044b \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e memset() \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 RtlSecureZeroMemory(), \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435\u0442 \u0432 Linux. \u041d\u043e \u0435\u0441\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f: V597 The compiler could delete the &#8216;memset&#8217; function call, which is used to flush &#8216;temp_result&#8217; buffer. The RtlSecureZeroMemory() function should be used to erase the private data. sha512-crypt.c 396<\/p>\n<h3>Undefined behavior<\/h3>\n<p>  \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 glibc \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c \u0432 \u043d\u0435\u0439 \u043d\u0435\u043c\u0430\u043b\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0441\u0434\u0432\u0438\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0412\u043e\u0442 \u0447\u0442\u043e \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u044f\u0437\u044b\u043a\u0430 \u0421\u0438 \u043e \u0441\u0434\u0432\u0438\u0433\u0430\u0445:<\/p>\n<p>  The integer promotions are performed on each of the operands. The type of the result is that of the promoted left operand. If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined.<\/p>\n<p>  The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an unsigned type, the value of the result is E1? 2E2, reduced modulo one more than the maximum value representable in the result type. If E1 has a signed type and nonnegative value, and E1? 2E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined.<\/p>\n<p>  5 The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1 \/ 2E2. If E1 has a signed type and a negative value, the resulting value is implementation-defined.<\/p>\n<p>  \u0418\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 glibc.<\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0434\u0432\u0438\u0433\u0430 \u0432\u043b\u0435\u0432\u043e:<\/b>  <\/p>\n<pre><code class=\"cpp\">static void init_cacheinfo (void) {   ....   count_mask = ~(-1 &lt;&lt; (count_mask + 1));   .... }<\/code><\/pre>\n<p>  V610 Undefined behavior. Check the shift operator &#8216;&lt;&lt;. The left operand &#8216;-1&#8217; is negative. cacheinfo.c 645<\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0434\u0432\u0438\u0433\u0430 \u0432\u043f\u0440\u0430\u0432\u043e:<\/b>   <\/p>\n<pre><code class=\"cpp\">utf8_encode (char *buf, int val) {   ....   *buf = (unsigned char) (~0xff &gt;&gt; step);   .... }<\/code><\/pre>\n<p>  \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 &quot;~0xff&quot; \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f &#8216;int&#8217; \u0440\u0430\u0432\u043d\u043e -256.<\/p>\n<p>  \u0412\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043c\u0435\u0441\u0442, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0441\u0434\u0432\u0438\u0433\u0438:<\/p>\n<ul>\n<li>strxfrm_l.c 68<\/li>\n<li>clock_nanosleep.c 38<\/li>\n<li>ifaddrs.c 786<\/li>\n<li>xdr_intXX_t.c 35<\/li>\n<li>xdr_intXX_t.c 41<\/li>\n<li>private.h 327<\/li>\n<li>private.h 331<\/li>\n<li>zic.c 696<\/li>\n<li>zdump.c 212<\/li>\n<li>zdump.c 216<\/li>\n<li>timer_create.c 47<\/li>\n<li>timer_create.c 49<\/li>\n<li>loop.c 331<\/li>\n<li>loop.c 437<\/li>\n<li>mktime.c 207<\/li>\n<li>mktime.c 208<\/li>\n<li>mktime.c 211<\/li>\n<li>mktime.c 212<\/li>\n<li>mktime.c 230<\/li>\n<li>mktime.c 298<\/li>\n<li>mktime.c 298<\/li>\n<li>ld-collate.c 298<\/li>\n<\/ul>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static int send_vc(....) {   ....   int truncating, connreset, resplen, n;   ....   #ifdef _STRING_ARCH_unaligned     *anssizp2 = orig_anssizp - resplen;     *ansp2 = *ansp + resplen;   #else   .... } V614 Uninitialized variable 'resplen' used. res_send.c 790<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a<\/h3>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f &#8216;%u&#8217;. \u0415\u0449\u0451 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f &#8216;%d&#8217;. \u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u0435\u043b\u043e\u0447\u0438, \u043d\u043e \u0438\u0445 \u0442\u043e\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"cpp\">typedef unsigned int __uid_t; typedef __uid_t uid_t;  int user2netname (...., const uid_t uid, ....) {   ....   sprintf (netname, &quot;%s.%d@%s&quot;, OPSYS, uid, dfltdom);   .... }<\/code><\/pre>\n<p>  V576 Incorrect format. Consider checking the fourth actual argument of the &#8216;sprintf&#8217; function. The SIGNED integer type argument is expected. netname.c 51<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>Consider checking the second actual argument of the &#8216;printf&#8217; function. The SIGNED integer type argument is expected. locarchive.c 1741<\/li>\n<li>Consider checking the fourth actual argument of the &#8216;printf&#8217; function. The SIGNED integer type argument is expected. locarchive.c 1741<\/li>\n<li>Consider checking the fifth actual argument of the &#8216;fprintf&#8217; function. The SIGNED integer type argument is expected. res_debug.c 236<\/li>\n<li>Consider checking the third actual argument of the &#8216;sprintf&#8217; function. The UNSIGNED integer type argument is expected. inet_net_ntop.c 134<\/li>\n<li>Consider checking the fourth actual argument of the &#8216;sprintf&#8217; function. The SIGNED integer type argument is expected. ns_print.c 500<\/li>\n<li>Consider checking the fifth actual argument of the &#8216;sprintf&#8217; function. The SIGNED integer type argument is expected. ns_print.c 500<\/li>\n<li>Consider checking the third actual argument of the &#8216;sprintf&#8217; function. The SIGNED integer type argument is expected. ns_print.c 572<\/li>\n<li>Consider checking the fourth actual argument of the &#8216;sprintf&#8217; function. The SIGNED integer type argument is expected. ns_print.c 572<\/li>\n<li>Consider checking the fifth actual argument of the &#8216;sprintf&#8217; function. The SIGNED integer type argument is expected. ns_print.c 572<\/li>\n<li>Consider checking the third actual argument of the &#8216;sprintf&#8217; function. The UNSIGNED integer type argument is expected. ns_print.c 628<\/li>\n<li>Consider checking the fourth actual argument of the &#8216;sprintf&#8217; function. The UNSIGNED integer type argument is expected. ns_print.c 628<\/li>\n<li>Consider checking the fifth actual argument of the &#8216;sprintf&#8217; function. The UNSIGNED integer type argument is expected. ns_print.c 628<\/li>\n<li>Consider checking the third actual argument of the &#8216;sprintf&#8217; function. The SIGNED integer type argument is expected. ns_print.c 645<\/li>\n<li>Consider checking the third actual argument of the &#8216;sprintf&#8217; function. The UNSIGNED integer type argument is expected. ns_print.c 685<\/li>\n<li>Consider checking the second actual argument of the &#8216;printf&#8217; function. The SIGNED integer type argument is expected. nis_print.c 209<\/li>\n<li>Consider checking the second actual argument of the &#8216;printf&#8217; function. The SIGNED integer type argument is expected. sprof.c 480<\/li>\n<\/ul>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0412\u044b\u0431\u0440\u0430\u043d \u043d\u0435 \u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0434\u0430 \u0438\u0437 \u043c\u0438\u0440\u0430 Linux. \u041e\u043d \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439. \ud83d\ude42 \u0421\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u043e\u0448\u0438\u0431\u043a\u0438. \u041d\u043e \u043d\u0435 \u0431\u0435\u0434\u0430. \u043d\u0430\u0441 \u0436\u0434\u0451\u0442 \u043d\u0435\u043c\u0430\u043b\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432 Linux, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \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 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio.<\/p>\n<h2>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>  <\/p>\n<ol>\n<li>\u0410\u043d\u0434\u0440\u0435\u0439 \u041a\u0430\u0440\u043f\u043e\u0432. <a href=\"http:\/\/www.viva64.com\/ru\/b\/0087\/\">\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/a>.<\/li>\n<li>\u0414\u043c\u0438\u0442\u0440\u0438\u0439 \u0422\u043a\u0430\u0447\u0435\u043d\u043a\u043e. <a href=\"http:\/\/www.viva64.com\/ru\/b\/0231\/\">\u0411\u0435\u0441\u0435\u0434\u0430 \u0441 \u0410\u043d\u0434\u0440\u0435\u0435\u043c \u041a\u0430\u0440\u043f\u043e\u0432\u044b\u043c, \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 PVS-Studio \u0438 CppCat<\/a>.<\/li>\n<\/ol>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/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 \u0438 CppCat, \u0432\u0435\u0440\u0441\u0438\u044f 2014<\/a>.  <\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/company\/pvs-studio\/blog\/213969\/\"> http:\/\/habrahabr.ru\/company\/pvs-studio\/blog\/213969\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ff2\/600\/1c0\/ff26001c02cc1841ad22c1b9549cac18.png\" alt=\"glibc and PVS-Studio\" align=\"left\"\/> <br \/>  \u041c\u044b \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 glibc \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio. \u0426\u0435\u043b\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c Linux-\u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u041f\u043e\u043a\u0430 \u043f\u043b\u043e\u0445\u043e \u043c\u043e\u0436\u0435\u0442. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u0438\u0437-\u0437\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e, \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0435 \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e.  <\/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-213969","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/213969","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=213969"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/213969\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=213969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=213969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=213969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}