{"id":287274,"date":"2018-08-16T14:05:35","date_gmt":"2018-08-16T10:05:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287274"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287274","title":{"rendered":"\u0410\u0432\u0442\u043e\u0440\u044b \u0438\u0433\u0440\u044b 0 A.D. \u2014 \u043c\u043e\u043b\u043e\u0434\u0446\u044b"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/company\/pvs-studio\/blog\/420267\/\" class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6c5\/b41\/bfb\/6c5b41bfb68b23ef10d61f6ecd1a6665.png\" alt=\"PVS-Studio &amp; 0 A.D.\"><\/div>\n<p>  0 A.D. \u2014 \u044d\u0442\u043e \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u0432 \u0436\u0430\u043d\u0440\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u043e\u0431\u0440\u043e\u0432\u043e\u043b\u044c\u0446\u0435\u0432. \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438\u0433\u0440\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0434\u044b\u0445\u0430 \u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a Android \u0438 XNU Kernel. \u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 165000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C++. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>0 A.D.<\/h2>\n<p>  <a href=\"https:\/\/play0ad.com\/\">0 A.D.<\/a> (0 \u0433\u043e\u0434 \u043d. \u044d.) \u2014 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430\u044f \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u0432 \u0436\u0430\u043d\u0440\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u043e\u0431\u0440\u043e\u0432\u043e\u043b\u044c\u0446\u0435\u0432 (\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 Wildfire Games). \u0418\u0433\u0440\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0446\u0438\u0432\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0432\u0448\u0438\u043c\u0438 \u0432 \u043f\u0435\u0440\u0438\u043e\u0434 500 \u0433\u043e\u0434 \u0434\u043e \u043d. \u044d.\u20141 \u0433\u043e\u0434 \u0434\u043e \u043d. \u044d. \u041f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043d\u0430 \u043b\u0435\u0442\u043e 2018 \u0433\u043e\u0434\u0430, \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0430\u043b\u044c\u0444\u0430-\u0432\u0435\u0440\u0441\u0438\u0438. [<a href=\"https:\/\/ru.wikipedia.org\/wiki\/0_A.D.\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u0432\u0437\u044f\u0442\u043e \u0438\u0437 Wikipedia].<\/p>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e 0 A.D.?<\/p>\n<p>  \u042f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u043a\u043e\u043b\u043b\u0435\u0433\u0443 <a href=\"https:\/\/www.viva64.com\/ru\/b\/a\/egor-bredikhin\/\">\u0415\u0433\u043e\u0440\u0430 \u0411\u0440\u0435\u0434\u0438\u0445\u0438\u043d\u0430<\/a> (<a href=\"https:\/\/habr.com\/users\/egorbredikhin\/\" class=\"user_link\">EgorBredikhin<\/a>) \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0431\u044b \u043c\u043e\u0433 \u043f\u043e\u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u0430\u0445 \u043c\u0435\u0436\u0434\u0443 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438. \u041e\u043d \u043f\u0440\u0438\u0441\u043b\u0430\u043b \u043c\u043d\u0435 \u043b\u043e\u0433 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 0 A.D. \u041d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441: \u00ab\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442?\u00bb \u2014 \u0431\u044b\u043b \u043e\u0442\u0432\u0435\u0442: \u00ab\u0414\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0433\u0440\u0430\u043b \u0432 \u044d\u0442\u0443 \u0438\u0433\u0440\u0443, \u043d\u0435\u043f\u043b\u043e\u0445\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438\u00bb. Ok, \u0437\u043d\u0430\u0447\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 0 A.D. :).<\/p>\n<h2>\u041f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a<\/h2>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0445\u043e\u0447\u0443 \u043f\u043e\u0445\u0432\u0430\u043b\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u043e\u0432 0 A.D. \u0437\u0430 \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0421++ \u043a\u043e\u0434\u0430. \u041c\u043e\u043b\u043e\u0434\u0446\u044b, \u0440\u0435\u0434\u043a\u043e \u0443\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043d\u0438\u0437\u043a\u0443\u044e \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a. \u0418\u043c\u0435\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0443, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0432\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0430 \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio. \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u0445\u043e\u0442\u044f PVS-Studio \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0432\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043a\u043e\u0434\u0430 \u0432 \u0446\u0435\u043b\u043e\u043c.<\/p>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u0435\u043b. \u041e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 231270. \u0418\u0437 \u043d\u0438\u0445 28.7% \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438. \u0418\u0442\u043e\u0433\u043e, 165000 \u0441\u0442\u0440\u043e\u043a \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C++.<\/p>\n<p>  \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c, \u0431\u044b\u043b\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0438\u0445 \u0432\u0441\u0435, \u044f \u0432\u044b\u043f\u0438\u0441\u0430\u043b 19 \u043e\u0448\u0438\u0431\u043e\u043a. \u0412\u0441\u0435 \u044d\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0434\u0430\u043b\u0435\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044f \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0432 \u043e\u0448\u0438\u0431\u043a\u0443 \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u044b\u043c \u043d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u044d\u0442\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u044f \u043d\u0430\u0448\u0435\u043b 19 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0430 165000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a: 19*1000\/165000 = 0.115.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043e\u043a\u0440\u0443\u0433\u043b\u0438\u043c \u0438 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0432 \u043a\u043e\u0434\u0435 \u0438\u0433\u0440\u044b 0.1 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0430 1000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442! \u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u0432 \u043c\u043e\u0435\u0439 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 <a href=\"https:\/\/www.viva64.com\/ru\/b\/0579\/\">\u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e Android<\/a> \u044f \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b, \u0447\u0442\u043e \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u043b \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 0.25 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0430 1000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u0442\u0430\u043c \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u0438\u043b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0441\u044c \u043e\u0442\u0447\u0451\u0442. <\/p>\n<p>  \u0418\u043b\u0438 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 EFL Core Libraries, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e <a href=\"https:\/\/www.viva64.com\/ru\/b\/0523\/\">\u0438\u0437\u0443\u0447\u0438\u043b<\/a> \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0444\u0435\u043a\u0442\u043e\u0432. \u0412 \u043d\u0435\u0439 PVS-Studio \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 0.71 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0430 1000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0430\u0432\u0442\u043e\u0440\u044b 0 A.D. \u2014 \u043c\u043e\u043b\u043e\u0434\u0446\u044b, \u043e\u0434\u043d\u0430\u043a\u043e, \u0440\u0430\u0434\u0438 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0438\u043c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043c\u0430\u043b\u044b\u0439 \u043e\u0431\u044a\u0451\u043c \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 C++. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0435\u043a\u0442, \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0430\u0441\u0442\u0451\u0442 \u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e (<a href=\"https:\/\/www.viva64.com\/ru\/b\/0158\/\">\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435<\/a>).<\/p>\n<h2>\u041e\u0448\u0438\u0431\u043a\u0438<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 19 \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u044e \u0432 \u0438\u0433\u0440\u0435. \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/www.viva64.com\/ru\/pvs-studio\/\">PVS-Studio<\/a> \u0432\u0435\u0440\u0441\u0438\u0438 6.24. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435.<\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/b> \u041c\u044b \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u043c PVS-Studio \u043a\u0430\u043a B2B \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0414\u043b\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438: &#171;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0457\/\">\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PVS-Studio \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e<\/a>&#171;.<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N1<\/b><\/p>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043e\u043d\u0430 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043d\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u043a\u043e\u0434\u0430.<\/p>\n<pre><code class=\"cpp\">void WaterManager::CreateWaveMeshes() {   ....   int nbNeighb = 0;   ....   bool found = false;   nbNeighb = 0;   for (int p = 0; p &lt; 8; ++p)   {     if (CoastalPointsSet.count(xx+around[p][0] +                                (yy + around[p][1])*SideSize))     {       if (nbNeighb &gt;= 2)       {         CoastalPointsSet.erase(xx + yy*SideSize);         continue;       }       ++nbNeighb;       \/\/ We've found a new point around us.       \/\/ Move there       xx = xx + around[p][0];       yy = yy + around[p][1];       indexx = xx + yy*SideSize;       if (i == 0)         Chain.push_back(CoastalPoint(indexx,CVector2D(xx*2,yy*2)));       else         Chain.push_front(CoastalPoint(indexx,CVector2D(xx*2,yy*2)));       CoastalPointsSet.erase(xx + yy*SideSize);       found = true;       break;     }   }   if (!found)     endedChain = true;   .... }<\/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\/v547\/\">V547<\/a> CWE-570 Expression &#8216;nbNeighb &gt;= 2&#8217; is always false. WaterManager.cpp 581<\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c. \u041f\u043e\u0447\u0435\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <i>nbNeighb &gt;= 2 <\/i> \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u043e\u0436\u043d\u043e\u0435? \u0412\u0435\u0434\u044c \u0432 \u0442\u0435\u043b\u0435 \u0446\u0438\u043a\u043b\u0430 \u0435\u0441\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>nbNeighb<\/i>!<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0438\u0436\u0435 \u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>break<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>nbNeighb<\/i> \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0430, \u0442\u043e \u0446\u0438\u043a\u043b \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>nbNeighb<\/i> \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 1.<\/p>\n<p>  \u041a\u043e\u0434 \u044f\u0432\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N2<\/b><\/p>\n<pre><code class=\"cpp\">void CmpRallyPointRenderer::MergeVisibilitySegments(   std::deque&lt;SVisibilitySegment&gt;&amp; segments) {   ....   segments.erase(segments.end());   .... }<\/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\/v783\/\">V783<\/a> CWE-119 Dereferencing of the invalid iterator &#8216;segments.end()&#8217; might take place. CCmpRallyPointRenderer.cpp 1290<\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c, \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0445\u043e\u0442\u0435\u043b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:<\/p>\n<pre><code class=\"cpp\">segments.erase(segments.back());<\/code><\/pre>\n<p>  \u0425\u043e\u0442\u044f, \u0442\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">segments.pop_back();<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u043c\u043d\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e.<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N3, N4<\/b><\/p>\n<p>  \u0420\u0435\u0448\u0438\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0434\u0432\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0443\u0442\u0435\u0447\u043a\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0430\u043a\u0440\u043e\u0441 <i>WARN_RETURN<\/i>.<\/p>\n<pre><code class=\"cpp\">#define WARN_RETURN(status)\\   do\\   {\\     DEBUG_WARN_ERR(status);\\     return status;\\   }\\   while(0)<\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u0430\u043a\u0440\u043e\u0441 <i>WARN_RETURN<\/i> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u044b\u0445\u043e\u0434\u0443 \u0438\u0437 \u0442\u0435\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u043a\u0440\u043e\u0441\u0430.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442.<\/p>\n<pre><code class=\"cpp\">Status sys_generate_random_bytes(u8* buf, size_t count) {   FILE* f = fopen(\"\/dev\/urandom\", \"rb\");   if (!f)     WARN_RETURN(ERR::FAIL);    while (count)   {     size_t numread = fread(buf, 1, count, f);     if (numread == 0)       WARN_RETURN(ERR::FAIL);     buf += numread;     count -= numread;   }    fclose(f);   return INFO::OK; }<\/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\/v773\/\">V773<\/a> CWE-401 The function was exited without releasing the &#8216;f&#8217; handle. A resource leak is possible. unix.cpp 332<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>fread <\/i> \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>sys_generate_random_bytes<\/i> \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0431\u0435\u0437 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0442\u0430\u043a\u043e\u0435 \u043d\u0430\u0432\u0440\u044f\u0434 \u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0421\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 &#171;\/dev\/urandom&#187;. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043a\u043e\u0434 \u043d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u0439.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442.<\/p>\n<pre><code class=\"cpp\">Status sys_cursor_create(....) {   ....   sys_cursor_impl* impl = new sys_cursor_impl;   impl-&gt;image = image;   impl-&gt;cursor = XcursorImageLoadCursor(wminfo.info.x11.display, image);   if(impl-&gt;cursor == None)     WARN_RETURN(ERR::FAIL);    *cursor = static_cast&lt;sys_cursor&gt;(impl);   return INFO::OK; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V773 CWE-401 The function was exited without releasing the &#8216;impl&#8217; pointer. A memory leak is possible. x.cpp 421<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u0443\u0440\u0441\u043e\u0440, \u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N5<\/b><\/p>\n<pre><code class=\"cpp\">Status LoadHeightmapImageOs(....) {   ....   shared_ptr&lt;u8&gt; fileData = shared_ptr&lt;u8&gt;(new u8[fileSize]);   .... }<\/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\/v554\/\">V554<\/a> CWE-762 Incorrect use of shared_ptr. The memory allocated with &#8216;new []&#8217; will be cleaned using &#8216;delete&#8217;. MapIO.cpp 54<\/p>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<pre><code class=\"cpp\">shared_ptr&lt;u8[]&gt; fileData = shared_ptr&lt;u8&gt;(new u8[fileSize]);<\/code><\/pre>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N6<\/b><\/p>\n<pre><code class=\"cpp\">FUTrackedPtr(ObjectClass* _ptr = NULL) : ptr(_ptr) {   if (ptr != NULL) FUTracker::TrackObject((FUTrackable*) ptr);   ptr = ptr; }<\/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\/v570\/\">V570<\/a> The &#8216;ptr&#8217; variable is assigned to itself. FUTracker.h 122<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N7, N8<\/b>  <\/p>\n<pre><code class=\"cpp\">std::wstring TraceEntry::EncodeAsText() const {   const wchar_t action = (wchar_t)m_action;   wchar_t buf[1000];   swprintf_s(buf, ARRAY_SIZE(buf), L\"%#010f: %c \\\"%ls\\\" %lu\\n\",              m_timestamp, action, m_pathname.string().c_str(),              (unsigned long)m_size);   return buf; }<\/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\/v576\/\">V576<\/a> CWE-628 Incorrect format. Consider checking the fifth actual argument of the &#8216;swprintf_s&#8217; function. The char type argument is expected. trace.cpp 93<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e\u0439 \u0438 \u043d\u0435\u0432\u043d\u044f\u0442\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>swprintf <\/i> \u0432 Visual C++. \u041f\u0435\u0440\u0435\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0451 \u043d\u0435 \u0431\u0443\u0434\u0443, \u0430 \u043e\u0442\u0441\u044b\u043b\u0430\u044e \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435 <a href=\"https:\/\/www.viva64.com\/ru\/w\/v576\/\">V576<\/a> (\u0441\u043c. \u0440\u0430\u0437\u0434\u0435\u043b \u00ab\u0428\u0438\u0440\u043e\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438\u00bb).<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432 Visual C++ \u0434\u043b\u044f Windows \u0438 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0434\u043b\u044f Linux \u0438\u043b\u0438 macOS.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430: V576 CWE-628 Incorrect format. Consider checking the fourth actual argument of the &#8216;swprintf_s&#8217; function. The char type argument is expected. vfs_tree.cpp 211<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N9, N10, N11<\/b><\/p>\n<p>  <a href=\"https:\/\/www.viva64.com\/ru\/examples\/v595\/\">\u041a\u043b\u0430\u0441\u0441\u0438\u043a\u0430<\/a>. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"cpp\">static void TEST_CAT2(char* dst, ....) {   strcpy(dst, dst_val);                                 \/\/ &lt;=   int ret = strcat_s(dst, max_dst_chars, src);   TS_ASSERT_EQUALS(ret, expected_ret);   if(dst != 0)                                          \/\/ &lt;=     TS_ASSERT(!strcmp(dst, expected_dst)); }<\/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\/v595\/\">V595<\/a> CWE-476 The &#8216;dst&#8217; pointer was utilized before it was verified against nullptr. Check lines: 140, 143. test_secure_crt.h 140<\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e, \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>V595 CWE-476 The &#8216;dst&#8217; pointer was utilized before it was verified against nullptr. Check lines: 150, 153. test_secure_crt.h 150<\/li>\n<li>V595 CWE-476 The &#8216;dst&#8217; pointer was utilized before it was verified against nullptr. Check lines: 314, 317. test_secure_crt.h 314<\/li>\n<\/ul>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N12<\/b><\/p>\n<pre><code class=\"cpp\">typedef int tbool;  void MikkTSpace::setTSpace(....,                            const tbool bIsOrientationPreserving,                            ....) {   ....   m_NewVertices.push_back(bIsOrientationPreserving &gt; 0.5 ? 1.0f : (-1.0f));   .... }<\/code><\/pre>\n<p>  <a href=\"https:\/\/www.viva64.com\/ru\/w\/v674\/\">V674<\/a> CWE-682 The &#8216;0.5&#8217; literal of the &#8216;double&#8217; type is compared to a value of the &#8216;int&#8217; type. Consider inspecting the &#8216;bIsOrientationPreserving &gt; 0.5&#8217; expression. MikktspaceWrap.cpp 137<\/p>\n<p>  \u041d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 <i>int <\/i> \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 0.5. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u0443 \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 boolean, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0435\u0451 \u0441 0.5 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0443, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e <i>bIsOrientationPreserving<\/i> \u0437\u0434\u0435\u0441\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f.<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N13<\/b><\/p>\n<pre><code class=\"cpp\">virtual Status ReplaceFile(const VfsPath&amp; pathname,                            const shared_ptr&lt;u8&gt;&amp; fileContents, size_t size) {   ScopedLock s;   VfsDirectory* directory;   VfsFile* file;   Status st;   st = vfs_Lookup(pathname, &amp;m_rootDirectory, directory,                   &amp;file, VFS_LOOKUP_ADD|VFS_LOOKUP_CREATE);    \/\/ There is no such file, create it.   if (st == ERR::VFS_FILE_NOT_FOUND)   {     s.~ScopedLock();     return CreateFile(pathname, fileContents, size);   }   .... }<\/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\/v749\/\">V749<\/a> CWE-675 Destructor of the &#8216;s&#8217; object will be invoked a second time after leaving the object&#8217;s scope. vfs.cpp 165<\/p>\n<p>  \u0414\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b, \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <i>ScopedLock<\/i> \u00ab\u0440\u0430\u0437\u043b\u043e\u0447\u0438\u043b\u00bb \u043d\u0435\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440. \u0411\u0435\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <i>s <\/i> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0435\u0449\u0451 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422.\u0435. \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0434\u0432\u0430\u0436\u0434\u044b. \u042f \u043d\u0435 \u0438\u0437\u0443\u0447\u0430\u043b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <i>ScopedLock<\/i>, \u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u043e\u0438\u0442. \u0427\u0430\u0441\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \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 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u043e\u0448\u0438\u0431\u043a\u0430\u043c. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0432\u0441\u0451 \u0441\u043b\u043e\u043c\u0430\u0442\u044c, \u043c\u0435\u043d\u044f\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0430 <i>ScopedLock<\/i>.<\/p>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N14, N15, N16, N17<\/b><\/p>\n<pre><code class=\"cpp\">CFsmEvent* CFsm::AddEvent( unsigned int eventType ) {   ....   pEvent = new CFsmEvent( eventType );   if ( !pEvent ) return NULL;   .... }<\/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\/v668\/\">V668<\/a> CWE-570 There is no sense in testing the &#8216;pEvent&#8217; pointer against null, as the memory was allocated using the &#8216;new&#8217; operator. The exception will be generated in the case of memory allocation error. fsm.cpp 259<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <i>std::bad_alloc<\/i>.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043b\u0438\u0448\u043d\u044f\u044f, \u043d\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0451 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0445\u0443\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0442\u0435\u043b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <i>if <\/i> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439:<\/p>\n<pre><code class=\"cpp\">CFsmTransition* CFsm::AddTransition(....) {   ....   CFsmEvent* pEvent = AddEvent( eventType );   if ( !pEvent ) return NULL;    \/\/ Create new transition   CFsmTransition* pNewTransition = new CFsmTransition( state );   if ( !pNewTransition )   {     delete pEvent;     return NULL;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430: V668 CWE-570 There is no sense in testing the &#8216;pNewTransition&#8217; pointer against null, as the memory was allocated using the &#8216;new&#8217; operator. The exception will be generated in the case of memory allocation error. fsm.cpp 289<\/p>\n<p>  \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435 <i>pEvent<\/i>. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u0442\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u0443\u0442 \u043d\u0435 \u043e\u0434\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0430 \u0434\u0432\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>AddEvent<\/i>.<\/p>\n<pre><code class=\"cpp\">CFsmEvent* CFsm::AddEvent( unsigned int eventType ) {   CFsmEvent* pEvent = NULL;    \/\/ Lookup event by type   EventMap::iterator it = m_Events.find( eventType );   if ( it != m_Events.end() )   {     pEvent = it-&gt;second;   }   else   {     pEvent = new CFsmEvent( eventType );     if ( !pEvent ) return NULL;      \/\/ Store new event into internal map     m_Events[ eventType ] = pEvent;   }    return pEvent; }<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <i>new<\/i>. \u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u0431\u0435\u0440\u0451\u0442 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 <i>m_Events<\/i>. \u0414\u0430 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u043e\u0436\u0435, \u043a\u0441\u0442\u0430\u0442\u0438, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043c\u0435\u0449\u0451\u043d \u0432 <i>m_Events<\/i>.<\/p>\n<p>  \u0418 \u0442\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0430 \u043a\u0442\u043e \u0432\u043b\u0430\u0434\u0435\u0435\u0442 \u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 <i>m_Events<\/i>? \u042f \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u043d\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0433\u0434\u0435-\u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u0442 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0422\u043e\u0433\u0434\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>CFsm::AddTransition<\/i> \u0432\u043e\u043e\u0431\u0449\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u043c.<\/p>\n<p>  \u0423 \u043c\u0435\u043d\u044f \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">if ( !pNewTransition ) {   delete pEvent;   return NULL; }<\/code><\/pre>\n<p>  \u0414\u0440\u0443\u0433\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<ul>\n<li>V668 CWE-571 There is no sense in testing the &#8216;ret&#8217; pointer against null, as the memory was allocated using the &#8216;new&#8217; operator. The exception will be generated in the case of memory allocation error. TerrainTextureEntry.cpp 120<\/li>\n<li>V668 CWE-571 There is no sense in testing the &#8216;answer&#8217; pointer against null, as the memory was allocated using the &#8216;new&#8217; operator. The exception will be generated in the case of memory allocation error. SoundManager.cpp 542<\/li>\n<\/ul>\n<p>  <b>\u041e\u0448\u0438\u0431\u043a\u0430 N18, N19<\/b><\/p>\n<pre><code class=\"cpp\">static void dir_scan_callback(struct de *de, void *data) {   struct dir_scan_data *dsd = (struct dir_scan_data *) data;    if (dsd-&gt;entries == NULL || dsd-&gt;num_entries &gt;= dsd-&gt;arr_size) {     dsd-&gt;arr_size *= 2;     dsd-&gt;entries = (struct de *) realloc(dsd-&gt;entries, dsd-&gt;arr_size *                                          sizeof(dsd-&gt;entries[0]));   }   if (dsd-&gt;entries == NULL) {     \/\/ TODO(lsm): propagate an error to the caller     dsd-&gt;num_entries = 0;   } else {     dsd-&gt;entries[dsd-&gt;num_entries].file_name = mg_strdup(de-&gt;file_name);     dsd-&gt;entries[dsd-&gt;num_entries].st = de-&gt;st;     dsd-&gt;entries[dsd-&gt;num_entries].conn = de-&gt;conn;     dsd-&gt;num_entries++;   } }<\/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\/v701\/\">V701<\/a> CWE-401 realloc() possible leak: when realloc() fails in allocating memory, original pointer &#8216;dsd-&gt;entries&#8217; is lost. Consider assigning realloc() to a temporary pointer. mongoose.cpp 2462<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c, \u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>realloc<\/i>. \u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>realloc<\/i>.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>realloc <\/i> \u0432\u0435\u0440\u043d\u0451\u0442 NULL, \u0438 \u044d\u0442\u043e\u0442 NULL \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <i>dsd-&gt;entries<\/i>. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0441\u044f \u0432 <i>dsd-&gt;entries<\/i>. \u041f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430: V701 CWE-401 realloc() possible leak: when realloc() fails in allocating memory, original pointer &#8216;Buffer&#8217; is lost. Consider assigning realloc() to a temporary pointer. Preprocessor.cpp 84<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041d\u0435 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u0438\u043b\u0438 \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a. \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0440\u0430\u0437 \u043d\u0430 \u0440\u0430\u0437 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f. <a href=\"https:\/\/www.viva64.com\/ru\/b\/0580\/\">\u0427\u0442\u043e \u0432\u0438\u0436\u0443, \u0442\u043e \u0438 \u043f\u0438\u0448\u0443<\/a>.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0414\u043b\u044f \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043c\u043d\u043e\u0439 \u0432 Instagram <a href=\"https:\/\/www.instagram.com\/pvs_studio_unicorn\/\">@pvs_studio_unicorn<\/a> \u0438 \u0432 Twitter <a href=\"https:\/\/twitter.com\/Code_Analysis\">@Code_Analysis<\/a>.<\/p>\n<p><a href=\"https:\/\/www.viva64.com\/en\/b\/0581\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ts\/z9\/km\/tsz9kmyjtteajhd4x1au60rsrvq.png\" align=\"left\"><\/a><\/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:\/\/www.viva64.com\/en\/b\/0581\/\">Good job, authors of the game 0 A.D!<\/a><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/company\/pvs-studio\/blog\/420267\/\"> https:\/\/habr.com\/company\/pvs-studio\/blog\/420267\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/company\/pvs-studio\/blog\/420267\/\" class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6c5\/b41\/bfb\/6c5b41bfb68b23ef10d61f6ecd1a6665.png\" alt=\"PVS-Studio &amp; 0 A.D.\"><\/div>\n<p>  0 A.D. \u2014 \u044d\u0442\u043e \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u0432 \u0436\u0430\u043d\u0440\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u043e\u0431\u0440\u043e\u0432\u043e\u043b\u044c\u0446\u0435\u0432. \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438\u0433\u0440\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0434\u044b\u0445\u0430 \u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a Android \u0438 XNU Kernel. \u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 165000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C++. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio.  <\/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-287274","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287274","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=287274"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287274\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}