{"id":308691,"date":"2020-08-19T09:00:16","date_gmt":"2020-08-19T09:00:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=308691"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-08-19T09:00:16","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=308691","title":{"rendered":"\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a PMDK \u043e\u0442 Intel \u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/515736\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6b7\/517\/2ab\/6b75172ab5d594657f4fa07d3c98cca1.png\" alt=\"PVS-Studio, PMDK\"><\/div>\n<p>  \u041d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a PMDK, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u044d\u043d\u0435\u0440\u0433\u043e\u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u044d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C \u0438 C++ \u0441 \u043e\u0431\u0449\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u043e\u043a\u043e\u043b\u043e 170 KLOC, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u043e\u0431\u0437\u043e\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043d\u0435 \u0437\u0430\u0439\u043c\u0451\u0442 \u043c\u043d\u043e\u0433\u043e \u0441\u0438\u043b \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. Let&#39;s go.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 PVS-Studio \u0432\u0435\u0440\u0441\u0438\u0438 7.08. \u0427\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u0430\u0432\u043d\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u043d\u0430\u0448\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043d\u0430 \u043d\u0451\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0437\u0430\u0448\u0451\u043b \u043a \u043d\u0430\u043c, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0442\u0430\u0442\u044c\u0435 &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0633\/\">\u041a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0434\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0434\u043b\u044f C \u0438 C++ \u043a\u043e\u0434\u0430?<\/a>&quot; \u0438 <a href=\"https:\/\/www.viva64.com\/ru\/pvs-studio-download\/\">\u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c<\/a> \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0443\u044e \u0442\u0440\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0437\u0430\u0433\u043b\u044f\u043d\u0443 \u0432\u043d\u0443\u0442\u0440\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 PMDK \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0438 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u0430\u0445. \u041f\u043e \u043c\u043e\u0435\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044e, \u0438\u0445 \u0431\u044b\u043b\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0445\u043e\u0440\u043e\u0448\u0435\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0418\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e :). \u0427\u0442\u043e \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \u0438\u0437 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0418\u0442\u0430\u043a, PMDK \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u044d\u043d\u0435\u0440\u0433\u043e\u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/docs.pmem.io\/persistent-memory\/getting-started-guide\/what-is-pmdk\">PMDK Introduction<\/a>. \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/pmem\/pmdk\">pmdk<\/a>.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u044b \u044f \u0441\u043c\u043e\u0433\u0443 \u0432 \u043d\u0451\u043c \u043d\u0430\u0439\u0442\u0438. \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u044f \u0431\u044b\u043b \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u0435\u043d \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043e\u0442\u0447\u0451\u0442\u0430 \u0438 \u043c\u043e\u0433 \u043c\u043d\u043e\u0433\u043e\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0434\u0435\u0444\u0435\u043a\u0442\u043e\u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0451\u0439, \u0430 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0410 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u0432\u044b\u043f\u0438\u0441\u0430\u043b, \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 :).<\/p>\n<h2>\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>  <\/p>\n<h3>\u0420\u0430\u0437\u043c\u0435\u0440 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/h3>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043d\u0435\u0440\u0435\u0434\u043a\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u043e\u0439 \u043a\u043e\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u043d\u0430\u0434\u043e. \u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u0435\u0437\u043b\u043e, \u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u044f. \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 PMDK \u044f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u043b\u0430\u0432\u0435.<\/p>\n<pre><code class=\"cpp\">int main(int argc, char *argv[]) {   ....   struct pool *pop = malloc(sizeof(pop));   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V568 It&#39;s odd that &#39;sizeof()&#39; operator evaluates the size of a pointer to a class, but not the size of the &#39;pop&#39; class object. util_ctl.c 717<\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u043c\u044f\u0442\u0438. \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>sizeof<\/i> \u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442:<\/p>\n<pre><code class=\"cpp\">struct pool *pop = malloc(sizeof(pool));<\/code><\/pre>\n<p>  \u0438\u043b\u0438<\/p>\n<pre><code class=\"cpp\">struct pool *pop = malloc(sizeof(*pop));<\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <i>pool<\/i> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c:<\/p>\n<pre><code class=\"cpp\">struct pool {   struct ctl *ctl; };<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0440\u043e\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c. \u0412\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<h3>\u0414\u043b\u0438\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438<\/h3>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u043b\u0443\u0447\u0430\u044e, \u0433\u0434\u0435 \u0432\u043d\u043e\u0432\u044c \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <i>sizeof<\/i>.<\/p>\n<pre><code class=\"cpp\">typedef void *(*pmem2_memcpy_fn)(void *pmemdest, const void *src, size_t len,     unsigned flags);  static const char *initial_state = &quot;No code.&quot;;  static int test_rwx_prot_map_priv_do_execute(const struct test_case *tc,   int argc, char *argv[]) {   ....   char *addr_map = pmem2_map_get_address(map);   map-&gt;memcpy_fn(addr_map, initial_state, sizeof(initial_state), 0);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V579 [CWE-687] The memcpy_fn function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. pmem2_map_prot.c 513<\/p>\n<p>  \u0414\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u0432\u0435\u0440\u043d\u0435\u0435 \u043d\u0430 \u0435\u0451 \u0442\u0440\u0435\u0442\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>sizeof<\/i> \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430. \u041d\u043e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0432\u043d\u043e\u0432\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u0412\u0435\u0437\u0435\u043d\u0438\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 8 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438 \u0435\u0451 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0431\u043e\u0440\u043a\u0430 64-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u0441\u0435 8 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441\u0442\u0440\u043e\u043a\u0438 &quot;No code.&quot; \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0435\u0449\u0451 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. \u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0445\u043e\u0442\u0435\u043b\u0438 \u043b\u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c \u0438\u043b\u0438 \u043d\u0435\u0442. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f.<\/p>\n<p>  <b>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 1.<\/b> \u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c. \u0422\u043e\u0433\u0434\u0430 \u044f \u043d\u0435\u043f\u0440\u0430\u0432, \u0438 \u044d\u0442\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0435\u0431\u044f \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442. \u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0435 9 \u0431\u0430\u0439\u0442, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e 8. \u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0443\u043b\u044f \u043d\u0435\u0442, \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 <i>initial_state<\/i> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">static const char initial_state [] = &quot;No code.&quot;;<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <i>sizeof(initial_state)<\/i> \u0440\u0430\u0432\u043d\u043e 9.<\/p>\n<p>  <b>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 2.<\/b> \u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c \u0432\u043e\u0432\u0441\u0435 \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0438\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">UT_ASSERTeq(memcmp(addr_map, initial_state, strlen(initial_state)), 0);<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>strlen<\/i> \u0432\u0435\u0440\u043d\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 8 \u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438. \u0422\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0437\u0435\u043d\u0438\u0435 \u0438 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<h3>\u041f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0441\u0434\u0432\u0438\u0433<\/h3>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430.<\/p>\n<pre><code class=\"cpp\">static int clo_parse_single_uint(struct benchmark_clo *clo, const char *arg, void *ptr) {   ....   uint64_t tmax = ~0 &gt;&gt; (64 - 8 * clo-&gt;type_uint.size);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V610 [CWE-758] Unspecified behavior. Check the shift operator &#39;&gt;&gt;&#39;. The left operand &#39;~0&#39; is negative. clo.cpp 205<\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0434\u0432\u0438\u0433\u0430 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043f\u0440\u0430\u0432\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0445\u043e\u0442\u044f \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u043f\u0440\u0438 \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0432\u0435\u0437\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/h3>\n<p>  \u0418 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cpp\">#define BTT_CREATE_DEF_SIZE  (20 * 1UL &lt;&lt; 20) \/* 20 MB *\/<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V634 [CWE-783] The priority of the &#39;*&#39; operation is higher than that of the &#39;&lt;&lt;&#39; operation. It&#39;s possible that parentheses should be used in the expression. bttcreate.c 204<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443, \u0440\u0430\u0432\u043d\u0443\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e 20 MB, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0440\u0435\u0448\u0438\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:<\/p>\n<ul>\n<li>\u0421\u0434\u0432\u0438\u043d\u0443\u043b 1 \u043d\u0430 20 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1048576, \u0442.\u0435. 1 MB.<\/li>\n<li>\u0423\u043c\u043d\u043e\u0436\u0438\u043b 1 MB \u043d\u0430 20.<\/li>\n<\/ul>\n<p>  \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u0443\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0442\u0430\u043a: (20 * (1UL &lt;&lt; 20))<\/p>\n<p>  \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0434\u0432\u0438\u0433\u0430 \u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a: ((20 * 1UL) &lt;&lt; 20).<\/p>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0432\u0440\u044f\u0434 \u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0445\u043e\u0442\u0435\u043b, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043b\u043e\u0441\u044c \u0432 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 20 \u043d\u0430 1. \u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442.<\/p>\n<p>  \u041d\u043e \u044d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u0438\u0442 \u0441\u0435\u0431\u044f. \u041d\u0435\u0432\u0430\u0436\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<ul>\n<li>(20 * 1UL &lt;&lt; 20)<\/li>\n<li>(20 * (1UL &lt;&lt; 20))<\/li>\n<li>((20 * 1UL) &lt;&lt; 20)<\/li>\n<\/ul>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e <a href=\"https:\/\/godbolt.org\/z\/sPsoMT\">\u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439<\/a>! \u0412\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 20971520 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<h2>\u0414\u0440\u0443\u0433\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<\/h2>\n<p>  <\/p>\n<h3>\u041d\u0435 \u0442\u0430\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0441\u043a\u043e\u0431\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">#define STATUS_INFO_LENGTH_MISMATCH 0xc0000004  static void enum_handles(int op) {   ....   NTSTATUS status;   while ((status = NtQuerySystemInformation(       SystemExtendedHandleInformation,       hndl_info, hi_size, &amp;req_size)         == STATUS_INFO_LENGTH_MISMATCH)) {     hi_size = req_size + 4096;     hndl_info = (PSYSTEM_HANDLE_INFORMATION_EX)REALLOC(hndl_info,         hi_size);   }   UT_ASSERT(status &gt;= 0);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V593 [CWE-783] Consider reviewing the expression of the &#39;A = B == C&#39; kind. The expression is calculated as following: &#39;A = (B == C)&#39;. ut.c 641<\/p>\n<p>  \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432\u043e\u0442 \u0441\u044e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">while ((status = NtQuerySystemInformation(....) == STATUS_INFO_LENGTH_MISMATCH))<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0445\u043e\u0442\u0435\u043b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>status<\/i> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <i>NtQuerySystemInformation<\/i>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439.<\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (==) \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f (=), \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u0431\u043a\u0438. \u041d\u043e \u043e\u043f\u0435\u0447\u0430\u0442\u0430\u043b\u0441\u044f \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0438\u0445 \u043d\u0435 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0430\u0434\u043e. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442. \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">while ((status = NtQuerySystemInformation(....)) == STATUS_INFO_LENGTH_MISMATCH)<\/code><\/pre>\n<p>  \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438, \u043c\u0430\u043a\u0440\u043e\u0441 <i>UT_ASSERT<\/i> \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412\u0435\u0434\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <i>status<\/i> \u0432\u0441\u0435\u0433\u0434\u0430 \u0437\u0430\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043b\u043e\u0436\u044c (0) \u0438\u043b\u0438 \u0438\u0441\u0442\u0438\u043d\u0430 (1). \u0417\u043d\u0430\u0447\u0438\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 ([0..1] &gt;= 0) \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e.<\/p>\n<h3>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static enum pocli_ret pocli_args_obj_root(struct pocli_ctx *ctx, char *in, PMEMoid **oidp) {   char *input = strdup(in);   if (!input)     return POCLI_ERR_MALLOC;    if (!oidp)     return POCLI_ERR_PARS;   .... }<\/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 &#39;input&#39; pointer. A memory leak is possible. pmemobjcli.c 238<\/p>\n<p>  \u0415\u0441\u043b\u0438 <i>oidp<\/i> \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u0430 \u043a\u043e\u043f\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>strdup<\/i>. \u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0434\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">static enum pocli_ret pocli_args_obj_root(struct pocli_ctx *ctx, char *in, PMEMoid **oidp) {   if (!oidp)     return POCLI_ERR_PARS;    char *input = strdup(in);   if (!input)     return POCLI_ERR_MALLOC;   .... }<\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">static enum pocli_ret pocli_args_obj_root(struct pocli_ctx *ctx, char *in, PMEMoid **oidp) {   char *input = strdup(in);   if (!input)     return POCLI_ERR_MALLOC;    if (!oidp)   {     free(input);     return POCLI_ERR_PARS;   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">typedef long long os_off_t;  void do_memcpy(...., int dest_off, ....., size_t mapped_len, .....) {   ....   LSEEK(fd, (os_off_t)(dest_off + (int)(mapped_len \/ 2)), SEEK_SET);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V1028 [CWE-190] Possible overflow. Consider casting operands, not the result. memcpy_common.c 62<\/p>\n<p>  \u042f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a \u0442\u0438\u043f\u0443 <i>os_off_t<\/i> \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043d\u0435 \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043e\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 <i>int<\/i>. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0442\u0430\u043a \u0431\u044b \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043d\u0435\u044f\u0432\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043b\u0441\u044f \u0434\u043e \u0442\u0438\u043f\u0430 <i>os_off_t<\/i>. \u042f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e.<\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">LSEEK(fd, dest_off + (os_off_t)(mapped_len) \/ 2, SEEK_SET);<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <i>size_t<\/i> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 (\u0447\u0442\u043e\u0431 \u043d\u0435 \u0431\u044b\u043b\u043e \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430). \u0418 \u0437\u0430\u043e\u0434\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<h3>\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static DWORD get_rel_wait(const struct timespec *abstime) {   struct __timeb64 t;   _ftime64_s(&amp;t);   time_t now_ms = t.time * 1000 + t.millitm;   time_t ms = (time_t)(abstime-&gt;tv_sec * 1000 +     abstime-&gt;tv_nsec \/ 1000000);    DWORD rel_wait = (DWORD)(ms - now_ms);    return rel_wait &lt; 0 ? 0 : rel_wait; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V547 [CWE-570] Expression &#39;rel_wait &lt; 0&#39; is always false. Unsigned type value is never &lt; 0. os_thread_windows.c 359<\/p>\n<p>  \u041c\u043d\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043e\u0442 \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u0449\u0438\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043d\u043e \u043e\u043d\u0430 \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>rel_wait<\/i> \u0438\u043c\u0435\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f <i>DWORD<\/i>. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 <i>rel_wait &lt; 0<\/i> \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u0438\u043d\u0430.<\/p>\n<h3>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430<\/h3>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432 <i>assert<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u044e\u0442, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f Release \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>malloc<\/i> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 <i>NULL<\/i>. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">static void remove_extra_node(TOID(struct tree_map_node) *node) {   ....   unsigned char *new_key = (unsigned char *)malloc(new_key_size);   assert(new_key != NULL);   memcpy(new_key, D_RO(tmp)-&gt;key, D_RO(tmp)-&gt;key_size);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V575 [CWE-628] The potential null pointer is passed into &#39;memcpy&#39; function. Inspect the first argument. Check lines: 340, 338. rtree_map.c 340<\/p>\n<p>  \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043d\u0435\u0442 \u0434\u0430\u0436\u0435 <i>assert<\/i>:<\/p>\n<pre><code class=\"cpp\">static void calc_pi_mt(void) {   ....   HANDLE *workers = (HANDLE *) malloc(sizeof(HANDLE) * pending);   for (i = 0; i &lt; pending; ++i) {     workers[i] = CreateThread(NULL, 0, calc_pi,       &amp;tasks[i], 0, NULL);     if (workers[i] == NULL)       break;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V522 [CWE-690] There might be dereferencing of a potential null pointer &#39;workers&#39;. Check lines: 126, 124. pi.c 126<\/p>\n<p>  \u0422\u0430\u043a\u0438\u0445 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0434\u0430 \u044f \u043d\u0430\u0441\u0447\u0438\u0442\u0430\u043b \u043c\u0438\u043d\u0438\u043c\u0443\u043c 37 \u0448\u0442\u0443\u043a. \u0422\u0430\u043a \u0447\u0442\u043e \u044f \u043d\u0435 \u0432\u0438\u0436\u0443 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0438\u0445 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043a\u043e\u0434 \u0441 \u0437\u0430\u043f\u0430\u0445\u043e\u043c. \u042f \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043d\u0435\u0434\u043e\u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442 \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u041d\u0443\u043b\u0435\u0432\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u044f\u0432\u0438\u0442 \u0441\u0435\u0431\u044f \u043f\u0430\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0435\u0433\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u044b\u043c\u0438 \u0438 \u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u0447\u0451\u043c \u0434\u0435\u043b\u043e \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0443\u0436\u043d\u044b, \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0441\u0435\u043c \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0451\u0439 &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0558\/\">\u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f malloc<\/a>&quot;.<\/p>\n<h2>\u041a\u043e\u0434 \u0441 \u0437\u0430\u043f\u0430\u0445\u043e\u043c<\/h2>\n<p>  <\/p>\n<h3>\u0414\u0432\u043e\u0439\u043d\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 CloseHandle<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static void prepare_map(struct pmem2_map **map_ptr,   struct pmem2_config *cfg, struct pmem2_source *src) {   ....   HANDLE mh = CreateFileMapping(....);   ....   UT_ASSERTne(CloseHandle(mh), 0);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V586 [CWE-675] The &#39;CloseHandle&#39; function is called twice for deallocation of the same resource. pmem2_map.c 76<\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0413\u0434\u0435 \u0442\u0443\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <i>CloseHandle<\/i>? \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0430\u043a\u0440\u043e\u0441\u0430 <i>UT_ASSERTne<\/i>.<\/p>\n<pre><code class=\"cpp\">#define UT_ASSERTne(lhs, rhs)\\   do {\\     \/* See comment in UT_ASSERT. *\/\\     if (__builtin_constant_p(lhs) &amp;&amp; __builtin_constant_p(rhs))\\       UT_ASSERT_COMPILE_ERROR_ON((lhs) != (rhs));\\     UT_ASSERTne_rt(lhs, rhs);\\   } while (0)<\/code><\/pre>\n<p>  \u0421\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \u043d\u0435 \u0441\u0442\u0430\u043b\u043e. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <i>UT_ASSERT_COMPILE_ERROR_ON<\/i>? \u0427\u0442\u043e <i>\u0442\u0430\u043a\u043e\u0435 UT_ASSERTne_rt<\/i>?<\/p>\n<p>  \u041d\u0435 \u0441\u0442\u0430\u043d\u0443 \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0430\u043a\u0440\u043e\u0441\u0430 \u0438 \u043c\u0443\u0447\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f, \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0435\u0433\u043e \u0443 \u0441\u0435\u0431\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0434\u043d\u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0435. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0440\u0430\u0437\u0443 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0432\u0437\u044f\u0442\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">do {   if (0 &amp;&amp; 0) (void)((CloseHandle(mh)) != (0));   ((void)(((CloseHandle(mh)) != (0)) ||     (ut_fatal(&quot;.....&quot;, 76, __FUNCTION__, &quot;......: %s (0x%llx) != %s (0x%llx)&quot;,               &quot;CloseHandle(mh)&quot;, (unsigned long long)(CloseHandle(mh)), &quot;0&quot;,               (unsigned long long)(0)), 0))); } while (0);<\/code><\/pre>\n<p>  \u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u043e\u0436\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 (0 &amp;&amp; 0) \u0438, \u0432\u043e\u043e\u0431\u0449\u0435, \u0432\u0441\u0451 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0435\u0435\u0441\u044f \u043a \u0434\u0435\u043b\u0443. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"cpp\">((void)(((CloseHandle(mh)) != (0)) ||   (ut_fatal(...., &quot;assertion failure: %s (0x%llx) != %s (0x%llx)&quot;,             ....., (unsigned long long)(CloseHandle(mh)), .... ), 0)));<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0445\u0435\u043d\u0434\u043b\u0430. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u043d\u043e\u0432\u044c, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <i>CloseHandle<\/i> \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0445\u0435\u043d\u0434\u043b\u0430.<\/p>\n<p>  \u041e\u0448\u0438\u0431\u043a\u0438, \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a, \u0438 \u043d\u0435\u0442. \u0420\u0430\u0437 \u0445\u0435\u043d\u0434\u043b \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0434\u0432\u0430\u0436\u0434\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>CloseHandle<\/i>. \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441 \u0437\u0430\u043f\u0430\u0445\u043e\u043c. \u0411\u043e\u043b\u0435\u0435 \u0438\u0434\u0435\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0435\u0440\u043d\u044b\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d\u0430 \u0432\u0435\u0440\u043d\u0443\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438.<\/p>\n<h3>\u041d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (\u0441\u043d\u044f\u0442\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438)<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static int status_push(PMEMpoolcheck *ppc, struct check_status *st, uint32_t question) {   ....   } else {     status_msg_info_and_question(st-&gt;msg);            \/\/ &lt;=     st-&gt;question = question;     ppc-&gt;result = CHECK_RESULT_ASK_QUESTIONS;     st-&gt;answer = PMEMPOOL_CHECK_ANSWER_EMPTY;     PMDK_TAILQ_INSERT_TAIL(&amp;ppc-&gt;data-&gt;questions, st, next);   }   .... }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0451\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: V530 [CWE-252] The return value of function &#39;status_msg_info_and_question&#39; is required to be utilized. check_util.c 293<\/p>\n<p>  \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>status_msg_info_and_question<\/i>, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043d\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443. \u0422.\u0435. \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0410 \u0440\u0430\u0437 \u0442\u0430\u043a, \u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u0418, \u0445\u043e\u0442\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0435 \u043f\u0440\u0430\u0432, \u043e\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043a\u043e\u0434 \u0441 \u0437\u0430\u043f\u0430\u0445\u043e\u043c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>status_msg_info_and_question<\/i>.<\/p>\n<pre><code class=\"cpp\">static inline int status_msg_info_and_question(const char *msg) {   char *sep = strchr(msg, MSG_SEPARATOR);   if (sep) {     *sep = &#39; &#39;;     return 0;   }   return -1; }<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>strchr<\/i> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u0441\u043d\u044f\u0442\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 C \u043e\u043d\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">char * strchr ( const char *, int );<\/code><\/pre>\n<p>  \u041d\u0435 \u043b\u0443\u0447\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041d\u043e \u044f\u0437\u044b\u043a C \u0442\u0430\u043a\u043e\u0439, \u043a\u0430\u043a\u043e\u0439 \u0435\u0441\u0442\u044c :).<\/p>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0443\u0442\u0430\u043b\u0441\u044f \u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0410 \u0440\u0430\u0437 \u0442\u0430\u043a, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0445\u043e\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0438 \u0437\u0430\u043f\u0443\u0442\u0430\u043b\u0441\u044f, \u043e\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043a\u043e\u0434 \u0441 \u0437\u0430\u043f\u0430\u0445\u043e\u043c. \u0422\u043e, \u0447\u0442\u043e \u0441\u0431\u0438\u0432\u0430\u0435\u0442 \u0441 \u0442\u043e\u043b\u043a\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043c\u043e\u0436\u0435\u0442 \u0441\u0431\u0438\u0432\u0430\u0442\u044c \u0441 \u0442\u043e\u043b\u043a\u0443 \u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0435\u0442 \u043a\u043e\u0434. \u041b\u0443\u0447\u0448\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u0441\u0442\u043d\u043e, \u0443\u0431\u0440\u0430\u0432 <i>const<\/i>:<\/p>\n<pre><code class=\"cpp\">static inline int status_msg_info_and_question(char *msg) {   char *sep = strchr(msg, MSG_SEPARATOR);   if (sep) {     *sep = &#39; &#39;;     return 0;   }   return -1; }<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u043b\u0447\u0430\u0442\u044c.<\/p>\n<h3>\u041f\u0435\u0440\u0435\u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static struct memory_block heap_coalesce(struct palloc_heap *heap,   const struct memory_block *blocks[], int n) {   struct memory_block ret = MEMORY_BLOCK_NONE;    const struct memory_block *b = NULL;   ret.size_idx = 0;   for (int i = 0; i &lt; n; ++i) {     if (blocks[i] == NULL)       continue;     b = b ? b : blocks[i];     ret.size_idx += blocks[i] ? blocks[i]-&gt;size_idx : 0;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V547 [CWE-571] Expression &#39;blocks[i]&#39; is always true. heap.c 1054<\/p>\n<p>  \u0415\u0441\u043b\u0438 <i>blocks[i] == NULL<\/i>, \u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>continue<\/i> \u0438 \u0446\u0438\u043a\u043b \u043d\u0430\u0447\u043d\u0451\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 <i>blocks[i]<\/i> \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0438 \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u043c. \u041a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">.... for (int i = 0; i &lt; n; ++i) {   if (blocks[i] == NULL)     continue;   b = b ? b : blocks[i];   ret.size_idx += blocks[i]-&gt;size_idx; } ....<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">void win_mmap_fini(void) {   ....   if (mt-&gt;BaseAddress != NULL)     UnmapViewOfFile(mt-&gt;BaseAddress);   size_t release_size =     (char *)mt-&gt;EndAddress - (char *)mt-&gt;BaseAddress;   void *release_addr = (char *)mt-&gt;BaseAddress + mt-&gt;FileLen;   mmap_unreserve(release_addr, release_size - mt-&gt;FileLen);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V1004 [CWE-119] The &#39;(char *) mt-&gt;BaseAddress&#39; pointer was used unsafely after it was verified against nullptr. Check lines: 226, 235. win_mmap.c 235<\/p>\n<p>  \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>mt-&gt;BaseAddress<\/i> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c, \u043e \u0447\u0451\u043c \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430:<\/p>\n<pre><code class=\"cpp\">if (mt-&gt;BaseAddress != NULL)<\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0438\u0436\u0435 \u044d\u0442\u043e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0434\u0435\u0441\u044c:<\/p>\n<pre><code class=\"cpp\">size_t release_size =   (char *)mt-&gt;EndAddress - (char *)mt-&gt;BaseAddress;<\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043d\u0435\u043a\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0440\u0430\u0432\u043d\u043e\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f <i>mt-&gt;EndAddress<\/i>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u0438 \u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0430, \u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0441\u0451 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043a\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. \u0417\u0430\u043f\u0430\u0445 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u0435\u043d \u0438 \u0435\u043c\u0443 \u044f\u0432\u043d\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043f\u043e\u044f\u0441\u043d\u044f\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<\/p>\n<h3>\u041a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/h3>\n<p>  \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043a\u043e\u0434 \u043f\u0430\u0445\u043d\u0435\u0442, \u0435\u0441\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438. \u041b\u0435\u0433\u043a\u043e \u043e\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c\u0441\u044f \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e, \u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">static struct critnib *c;<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f PVS-Studio \u043d\u0430 \u0442\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>V707 Giving short names to global variables is considered to be bad practice. It is suggested to rename &#39;ri&#39; variable. map.c 131<\/li>\n<li>V707 Giving short names to global variables is considered to be bad practice. It is suggested to rename &#39;c&#39; variable. obj_critnib_mt.c 56<\/li>\n<li>V707 Giving short names to global variables is considered to be bad practice. It is suggested to rename &#39;Id&#39; variable. obj_list.h 68<\/li>\n<li>V707 Giving short names to global variables is considered to be bad practice. It is suggested to rename &#39;Id&#39; variable. obj_list.c 34<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0421\u0442\u0440\u0430\u043d\u043d\u043e\u0435<\/h2>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6d0\/05b\/d6d\/6d005bd6d867384a93c5043a84f51522.png\" alt=\"PVS-Studio: \u0421\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\"><\/div>\n<p>  \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>do_memmove<\/i>. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u0434\u0432\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u044e\u0442 \u0438\u043b\u0438 \u043e\u0431 \u043e\u0447\u0435\u043d\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445, \u0438\u043b\u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0438\u043c\u0435\u043b\u043e\u0441\u044c \u0432 \u0432\u0438\u0434\u0443. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u0434 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u0442\u0440\u0430\u043d\u0435\u043d, \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0430\u043d\u043e \u0437\u0434\u0435\u0441\u044c.<\/p>\n<pre><code class=\"cpp\">void do_memmove(char *dst, char *src, const char *file_name,     size_t dest_off, size_t src_off, size_t bytes,     memmove_fn fn, unsigned flags, persist_fn persist) {   ....   \/* do the same using regular memmove and verify that buffers match *\/   memmove(dstshadow + dest_off, dstshadow + dest_off, bytes \/ 2);   verify_contents(file_name, 0, dstshadow, dst, bytes);   verify_contents(file_name, 1, srcshadow, src, bytes);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V549 [CWE-688] The first argument of &#39;memmove&#39; function is equal to the second argument. memmove_common.c 71<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442. \u041a\u0430\u043a\u0438\u0435 \u043c\u043d\u0435 \u043d\u0430 \u0443\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c &quot;\u043f\u043e\u0442\u0440\u043e\u0433\u0430\u0442\u044c&quot; \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043b\u0438 \u044d\u0442\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438? \u041d\u0435 \u0443\u0434\u0430\u043b\u0438\u0442 \u043b\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0430\u043c \u0432 \u0441\u0435\u0431\u044f?<\/li>\n<li>\u042d\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>memmove<\/i>.<\/li>\n<li>\u041a\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0443.<\/li>\n<\/ul>\n<p>  \u0410 \u0432\u043e\u0442 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0432 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cpp\">void do_memmove(char *dst, char *src, const char *file_name,     size_t dest_off, size_t src_off, size_t bytes,     memmove_fn fn, unsigned flags, persist_fn persist) {   ....   \/* do the same using regular memmove and verify that buffers match *\/   memmove(dstshadow + dest_off, srcshadow + src_off, 0);   verify_contents(file_name, 2, dstshadow, dst, bytes);   verify_contents(file_name, 3, srcshadow, src, bytes);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V575 [CWE-628] The &#39;memmove&#39; function processes &#39;0&#39; elements. Inspect the third argument. memmove_common.c 82<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442 0 \u0431\u0430\u0439\u0442. \u0427\u0442\u043e \u044d\u0442\u043e? \u042e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442? \u041e\u043f\u0435\u0447\u0430\u0442\u043a\u0430?<\/p>\n<p>  \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u0435\u043d \u0438 \u0441\u0442\u0440\u0430\u043d\u0435\u043d.<\/p>\n<h2>\u0417\u0430\u0447\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043a\u043e\u0434\u0430?<\/h2>\n<p>  \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0440\u0430\u0437 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043c\u0430\u043b\u043e \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043e\u0434\u0430 \u043c\u0430\u043b\u043e\u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e. \u041d\u043e \u0441\u043c\u044b\u0441\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \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 \u043d\u0435 \u0432 \u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u0445, \u0430 \u0432 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u043c \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0435\u0449\u0451 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0440\u043e\u0433\u0438\u043c\u0438 \u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 (\u043e\u0442\u043b\u0430\u0434\u043a\u0430, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043e\u0442\u0437\u044b\u0432\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435). \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044d\u0442\u0430 \u043c\u044b\u0441\u043b\u044c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0639\/\">\u041e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/a>&quot;, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f. \u0410 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043a \u043d\u0430\u043c \u043d\u0430 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/www.viva64.com\/ru\/pvs-studio-download\/\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c<\/a> \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c PVS-Studio \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<p>  <a href=\"https:\/\/habr.com\/en\/company\/pvs-studio\/blog\/515730\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/898\/3b6\/5a7\/8983b65a74adb29a2113eba12fbec3f1.png\"><\/div>\n<p><\/a><br \/>  \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Andrey Karpov. <a href=\"https:\/\/habr.com\/en\/company\/pvs-studio\/blog\/515730\/\">Static code analysis of the PMDK library collection by Intel and errors that are not actual errors<\/a>.<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/515736\/\"> https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/515736\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/515736\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6b7\/517\/2ab\/6b75172ab5d594657f4fa07d3c98cca1.png\" alt=\"PVS-Studio, PMDK\"><\/div>\n<p>  \u041d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a PMDK, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u044d\u043d\u0435\u0440\u0433\u043e\u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u044d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C \u0438 C++ \u0441 \u043e\u0431\u0449\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u043e\u043a\u043e\u043b\u043e 170 KLOC, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u043e\u0431\u0437\u043e\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043d\u0435 \u0437\u0430\u0439\u043c\u0451\u0442 \u043c\u043d\u043e\u0433\u043e \u0441\u0438\u043b \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. Let&#39;s go.  <\/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-308691","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308691","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=308691"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308691\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=308691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=308691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=308691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}