{"id":192996,"date":"2013-09-09T10:12:03","date_gmt":"2013-09-09T06:12:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=192996"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=192996","title":{"rendered":"<span class=\"post_title\">\u0418\u0434\u0435\u043c \u043f\u043e \u0433\u0440\u0438\u0431\u044b \u043f\u043e\u0441\u043b\u0435 Cppcheck<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" align=\"left\" src=\"http:\/\/habr.habrastorage.org\/post_images\/4a6\/1b7\/b5d\/4a61b7b5d6ed4b01e0ff89ce60710c0e.png\" alt=\"PVS-Studio, OpenMS\"\/> <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0433\u043e\u0440\u044f\u0447\u0438\u0445 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0439 \u043f\u0440\u043e &quot;<a href=\"http:\/\/habrahabr.ru\/company\/pvs-studio\/blog\/192624\/\">\u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440<\/a>&quot;, \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0449\u0451 \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439. \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0430\u0448\u043b\u043e\u0441\u044c, \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 OpenMS, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 protein mass spectrometry. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c Cppcheck. \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0435\u043d\u0441\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0436\u0434\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 PVS-Studio \u043f\u043e\u0441\u043b\u0435 Cppcheck. \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 OpenMS. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d \u043d\u0443\u0436\u0435\u043d, \u044f \u043d\u0435 \u0431\u0435\u0440\u0443\u0441\u044c \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438. \u0415\u0449\u0451 \u043b\u044f\u043f\u043d\u0443 \u0433\u043b\u0443\u043f\u043e\u0441\u0442\u044c. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0446\u0438\u0442\u0438\u0440\u0443\u044e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441 \u0441\u0430\u0439\u0442\u0430 Wikipedia:<\/p>\n<p>  <i>OpenMS is an open-source project for data analysis and processing in <a href=\"http:\/\/www.viva64.com\/go.php?url=1299\"><i>protein mass spectrometry<\/i><\/a> and is released under the 2-clause BSD licence. OpenMS has tools for many common data analysis pipelines used in proteomics, providing algorithms for signal processing, feature finding (including de-isotoping), visualization in 1D (spectra or chromatogram level), 2D and 3D, map mapping and peptide identification. It supports label-free and isotopic-label based quantification (such as iTRAQ and TMT and SILAC). Furthermore, it also supports metabolomics workflows and DIA\/SWATH targeted analysis.<\/i><\/p>\n<p>  <i>\u041f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a: Wikipedia. <\/i> <a href=\"http:\/\/www.viva64.com\/go.php?url=1298\">OpenMS<\/a><\/p>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043d\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043b\u043e\u0436\u043d\u044b\u0439. \u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 20 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442. \u041f\u043b\u044e\u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a (Boost, Qt, Zlib \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435). \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u0447\u0435\u043d\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u044b. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e <a href=\"http:\/\/www.viva64.com\/go.php?url=1300\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441 \u0441\u0430\u0439\u0442\u0430 SourceForge<\/a>. <\/p>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 OpenMS \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430. \u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u00abcppcheck.cmake\u00bb \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0432 \u0434\u0443\u0445\u0435:  <\/p>\n<pre><code class=\"cpp\">if (i != peptide.size()) \/\/ added for cppcheck<\/code><\/pre>\n<p>  \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c Cppcheck. \u0422\u0430\u043a\u0436\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 <a href=\"http:\/\/www.viva64.com\/go.php?url=1301\">Cpplint<\/a> \u0438 \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b \u00abcpplint.py\u00bb. \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434. \u041c\u043e\u043b\u043e\u0434\u0446\u044b.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 <a href=\"http:\/\/www.viva64.com\/ru\/pvs-studio\/\">PVS-Studio<\/a>.<\/p>\n<p>  <b><i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/i><\/b><i> \u041e\u0442\u0447\u0435\u0433\u043e-\u0442\u043e \u0421\u0438++ \u0444\u0430\u0439\u043b\u044b \u043d\u043e\u0441\u044f\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 &#8216;*.c&#8217;. \u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0443\u0441\u0442\u044c \u0432\u0430\u0441 \u043d\u0435 \u0441\u043c\u0443\u0449\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0421\u0438++, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u0432 &#8216;*.c&#8217; \u0444\u0430\u0439\u043b\u0435.<\/i><\/p>\n<h2>1. \u041d\u0435\u0434\u043e\u0447\u0451\u0442\u044b \u0441 OpenMP<\/h2>\n<p>  \u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f <a href=\"http:\/\/www.viva64.com\/ru\/t\/0037\/\">OpenMP<\/a>. \u041c\u0435\u043d\u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0435\u0449\u0430\u044e\u0442 \u043c\u044b\u0441\u043b\u0438, \u0443\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u0438\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u044b\u043b \u0438\u0441\u043a\u0440\u0435\u043d\u043d\u0435 \u0443\u0434\u0438\u0432\u043b\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u0443\u0432\u0438\u0434\u0435\u043b \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 OpenMP. \u0417\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u043e\u0434, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u044f \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0443 \u0442\u0435\u043c\u0443. \u041d\u0430\u0434\u043e \u0436\u0435, \u043a\u0442\u043e-\u0442\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044d\u0442\u0443 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e.<\/p>\n<p>  \u0421\u0440\u0435\u0434\u0438 \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0435\u0441\u0442\u044c \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043d\u0430\u0448\u043b\u0438\u0441\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u043f\u043e \u0434\u0435\u043b\u0443.  <\/p>\n<pre><code class=\"cpp\">DoubleReal ILPDCWrapper::compute(....) const {   ....   DoubleReal score = 0;   ....   #pragma omp parallel for schedule(dynamic, 1)   for (SignedSize i = 0; i &lt; (SignedSize)bins.size(); ++i)   {     score += computeSlice_(fm, pairs, bins[i].first,                            bins[i].second, verbose_level);   }   return score; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V1205 Data race risk. Unprotected concurrent operation with the &#8216;score&#8217; variable. ilpdcwrapper.c 213<\/p>\n<p>  \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u043c\u043c\u0430. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#8216;score&#8217; \u043d\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u0430 \u043e\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445.<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0438\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043d\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u043d\u0430 \u043d\u0438\u0445 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u0439 \u0432\u0441\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u044b. \u0412\u044b\u0445\u043e\u0434 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u043c\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0437\u0430\u043c\u0435\u0442\u043a\u0430\u0445: &quot;<a href=\"http:\/\/www.viva64.com\/ru\/b\/0008\/\">OpenMP \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (exceptions)<\/a>&quot;, &quot;<a href=\"http:\/\/www.viva64.com\/ru\/b\/0024\/\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u0439<\/a>&quot;.<\/p>\n<p>  \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044f\u0432\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 throw. \u0422\u0430\u043a\u0436\u0435 \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 new (std::bad_alloc).<\/p>\n<p>  <b>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/b> \u0424\u0443\u043d\u043a\u0446\u0438\u044f getTheoreticalmaxPosition() \u043c\u043e\u0436\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.  <\/p>\n<pre><code class=\"cpp\">Size getTheoreticalmaxPosition() const {   if (!this-&gt;size())   {     throw Exception::Precondition(__FILE__, __LINE__,       __PRETTY_FUNCTION__,       &quot;There must be at least one trace to ......&quot;);   }   .... }  virtual void run() {   ....   #pragma omp parallel for   for (SignedSize i = 0; i &lt; (SignedSize)seeds.size(); ++i)   {     ....     f.setMZ(       traces[traces.getTheoreticalmaxPosition()].getAvgMZ());     ....   }   .... } <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V1301 The &#8216;throw&#8217; keyword cannot be used outside of a try..catch block in a parallel section. featurefinderalgorithmpickedhelperstructs.h 199<\/p>\n<p>  <b>\u0412\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/b> \u0412\u044b\u0437\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 &#8216;new&#8217; \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.  <\/p>\n<pre><code class=\"cpp\">TraceFitter&lt;PeakType&gt;* chooseTraceFitter_(double&amp; tau) {   \/\/ choose fitter   if (param_.getValue(&quot;feature:rt_shape&quot;) == &quot;asymmetric&quot;)   {     LOG_DEBUG &lt;&lt; &quot;use asymmetric rt peak shape&quot; &lt;&lt; std::endl;     tau = -1.0;     return new EGHTraceFitter&lt;PeakType&gt;();   }   .... }  virtual void run() {   ....   #pragma omp parallel for   for (SignedSize i = 0; i &lt; (SignedSize)seeds.size(); ++i)   {     ....     TraceFitter&lt;PeakType&gt;* fitter = chooseTraceFitter_(egh_tau);     ....   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V1302 The &#8216;new&#8217; operator cannot be used outside of a try..catch block in a parallel section. featurefinderalgorithmpicked.h 1926<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0438\u0435 \u0430\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>V1301 featurefinderalgorithmpicked.h 1261<\/li>\n<li>V1301 mzmlfile.h 114<\/li>\n<li>V1301 rawmssignalsimulation.c 598<\/li>\n<li>V1301 rawmssignalsimulation.c 1152<\/li>\n<li>V1301 chromatogramextractor.h 103<\/li>\n<li>V1301 chromatogramextractor.h 118<\/li>\n<li>V1302 featurefinderalgorithmpicked.h 1931<\/li>\n<li>V1302 rawmssignalsimulation.c 592<\/li>\n<li>V1302 rawmssignalsimulation.c 601<\/li>\n<li>V1302 openswathanalyzer.c 246<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>2. \u041e\u043f\u0435\u0447\u0430\u0442\u043a\u0438<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::vector&lt; std::pair&lt;std::string, long&gt; &gt; spectra_offsets; std::vector&lt; std::pair&lt;std::string, long&gt; &gt; chromatograms_offsets;  template &lt;typename MapType&gt; void MzMLHandler&lt;MapType&gt;::writeFooter_(std::ostream&amp; os) {   ....   int indexlists;   if (spectra_offsets.empty() &amp;&amp; spectra_offsets.empty() )   {     indexlists = 0;   }   else if (!spectra_offsets.empty() &amp;&amp; !spectra_offsets.empty() )   {     indexlists = 2;   }   else   {     indexlists = 1;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f PVS-Studio:<\/p>\n<p>  V501 There are identical sub-expressions &#8216;spectra_offsets.empty()&#8217; to the left and to the right of the &#8216;&amp;&amp;&#8217; operator. mzmlhandler.h 5288<\/p>\n<p>  V501 There are identical sub-expressions &#8216;!spectra_offsets.empty()&#8217; to the left and to the right of the &#8216;&amp;&amp;&#8217; operator. mzmlhandler.h 5292<\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u0414\u0432\u0430 \u0440\u0430\u0437\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 &#8216;spectra_offsets&#8217;. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u044d\u0442\u043e \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430 \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430: spectra_offsets \u0438 chromatograms_offsets.  <\/p>\n<pre><code class=\"cpp\">template &lt;typename MapType&gt; void MzMLHandler&lt;MapType&gt;::characters(   const XMLCh* const chars, const XMLSize_t) {   ....   if (optionalAttributeAsString_(data_processing_ref,                                  attributes,                                  s_data_processing_ref))   {     data_.back().meta.setDataProcessing(                         processing_[data_processing_ref]);   }   else   {     data_.back().meta.setDataProcessing(                         processing_[data_processing_ref]);   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V523 The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. mzmlhandler.h 534<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>processing_[data_processing_ref]<\/li>\n<li>processing_[default_processing_]<\/li>\n<\/ul>\n<p>  \u041c\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u041e\u0448\u0438\u0431\u043a\u0438 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b. \u0417\u0430\u0431\u044b\u0442\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e &#8216;throw&#8217;. \u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u0442\u0441\u044f. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438:  <\/p>\n<pre><code class=\"cpp\">inline UInt asUInt_(const String &amp; in) {   UInt res = 0;   try   {     Int tmp = in.toInt();     if (tmp &lt; 0)     {       Exception::ConversionError(         __FILE__, __LINE__, __PRETTY_FUNCTION__, &quot;&quot;);     }     res = UInt(tmp);   }   catch (Exception::ConversionError)   {     error(LOAD,            String(&quot;UInt conversion error of \\&quot;&quot;) + in + &quot;\\&quot;&quot;);   }   return res; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V596 The object was created but it is not being used. The &#8216;throw&#8217; keyword could be missing: throw ConversionError(FOO); xmlhandler.h 247<\/p>\n<p>  \u0418\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u0437\u0434\u0435\u0441\u044c:<\/p>\n<ul>\n<li>inclusionexclusionlist.c 281<\/li>\n<li>inclusionexclusionlist.c 285<\/li>\n<li>precursorionselectionpreprocessing.c 257<\/li>\n<li>modificationsdb.c 419<\/li>\n<li>modificationsdb.c 442<\/li>\n<li>svmtheoreticalspectrumgeneratorset.c 103<\/li>\n<li>logconfighandler.c 285<\/li>\n<li>logconfighandler.c 315<\/li>\n<li>suffixarraytrypticcompressed.c 488<\/li>\n<li>tooldescription.c 147<\/li>\n<li>tofcalibration.c 147<\/li>\n<\/ul>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043d\u0430\u044f \u043c\u043d\u043e\u0439 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430:  <\/p>\n<pre><code class=\"cpp\">inline typename Value&lt;Pipe&gt;::Type const &amp; operator*() {   tmp.i1 = *in.in1;   tmp.i2 = *in.in2;   tmp.i3 = *in.in2;   return tmp; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V525 The code containing the collection of similar blocks. Check items &#8216;in1&#8217;, &#8216;in2&#8217;, &#8216;in2&#8217; in lines 112, 113, 114. pipe_joiner.h 112<\/p>\n<p>  \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e:  <\/p>\n<pre><code class=\"cpp\">tmp.i1 = *in.in1; tmp.i2 = *in.in2; tmp.i3 = *in.in3;<\/code><\/pre>\n<p>  <\/p>\n<h2>3. \u0421\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">CompressedInputSource::CompressedInputSource(   const String &amp; file_path, const char * header,   MemoryManager * const manager)    : xercesc::InputSource(manager) {   if (sizeof(header) \/ sizeof(char) &gt; 1)   {     head_[0] = header[0];     head_[1] = header[1];   }   else   {     head_[0] = '\\0';     head_[1] = '\\0';   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V514 Dividing sizeof a pointer &#8216;sizeof (header)&#8217; by another value. There is a probability of logical error presence. compressedinputsource.c 52<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u0439\u0442\u0430, \u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u044f \u043d\u0435 \u0437\u043d\u0430\u044e \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0433\u0434\u0435 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0422\u0430\u043a \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c: compressedinputsource.c 104<\/p>\n<h2>4. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">template &lt;typename TStringSet, typename TSpec&gt; inline Iter&lt;TStringSet, ConcatVirtual&lt;TSpec&gt; &gt; const &amp; operator++(Iter&lt;TStringSet, ConcatVirtual&lt;TSpec&gt; &gt; &amp; me, int) {     Iter&lt;TStringSet, ConcatVirtual&lt;TSpec&gt; &gt; before = me;     goNext(me);     return before; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V558 Function returns the reference to temporary local object: before. iter_concat_virtual.h 277<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e &#8216;before&#8217;. \u041f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u044d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0440\u0430\u0437\u0440\u0443\u0448\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c.<\/p>\n<p>  \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440, \u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443:  <\/p>\n<pre><code class=\"cpp\">Iter&lt;TStringSet, ConcatVirtual&lt;TSpec&gt; &gt; &amp;before = me;<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0431\u0435\u0434\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &#8216;&#8212;&#8216;: iter_concat_virtual.h 310<\/p>\n<h2>5. \u041d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">typedef size_t Size; typedef double DoubleReal; void updateMeanEstimate(const DoubleReal &amp; x_t,   DoubleReal &amp; mean_t, Size t) {   DoubleReal tmp(mean_t);   tmp = mean_t + (1 \/ (t + 1)) * (x_t - mean_t);   mean_t = tmp; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V636 The &#8216;1 \/ (t + 1)&#8217; expression was implicitly casted from &#8216;int&#8217; type to &#8216;double&#8217; type. Consider utilizing an explicit type cast to avoid the loss of a fractional part. An example: double A = (double)(X) \/ Y;. masstracedetection.c 129<\/p>\n<p>  \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 &quot;(1 \/ (t + 1))&quot; \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e \u0438\u043b\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u0438\u043d\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u043d\u043e\u0435. \u042f \u043d\u0435 \u0437\u043d\u0430\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0438\u043c\u0435\u043b\u043e\u0441\u044c \u0432 \u0432\u0438\u0434\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code class=\"cpp\">tmp = mean_t + (1.0 \/ (t + 1)) * (x_t - mean_t);<\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b M_PI \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u044f\u0432\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0442\u043e\u0447\u043d\u044b\u0435. \u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0430, \u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e. \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"cpp\">bool PosteriorErrorProbabilityModel::fit(   std::vector&lt;double&gt; &amp; search_engine_scores) {   ....   incorrectly_assigned_fit_param_.A =     1 \/ sqrt(2 * 3.14159 *              pow(incorrectly_assigned_fit_param_.sigma, 2));   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V624 The constant 3.14159 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from &lt;math.h&gt;. posteriorerrorprobabilitymodel.c 92<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e: <\/p>\n<ul>\n<li>posteriorerrorprobabilitymodel.c 101<\/li>\n<li>posteriorerrorprobabilitymodel.c 110<\/li>\n<li>posteriorerrorprobabilitymodel.c 155<\/li>\n<li>posteriorerrorprobabilitymodel.c 162<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>6. \u0412\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">static const Int CHANNELS_FOURPLEX[4][1]; static const Int CHANNELS_EIGHTPLEX[8][1]; ExitCodes main_(int, const char **) {   ....   if (itraq_type == ItraqQuantifier::FOURPLEX)   {     for (Size i = 0; i &lt; 4; ++i)     {       std::vector&lt;std::pair&lt;String, DoubleReal&gt; &gt; one_label;       one_label.push_back(std::make_pair&lt;String, DoubleReal&gt;(         String(&quot;Channel &quot;) +           String(ItraqConstants::CHANNELS_FOURPLEX[i][0]),         DoubleReal(ItraqConstants::CHANNELS_FOURPLEX[i][0])));       labels.push_back(one_label);     }   }   else \/\/ItraqQuantifier::EIGHTPLEX   {     for (Size i = 0; i &lt; 8; ++i)     {       std::vector&lt;std::pair&lt;String, DoubleReal&gt; &gt; one_label;       one_label.push_back(std::make_pair&lt;String, DoubleReal&gt;(         String(&quot;Channel &quot;) +           String(ItraqConstants::CHANNELS_FOURPLEX[i][0]),         DoubleReal(ItraqConstants::CHANNELS_FOURPLEX[i][0])));       labels.push_back(one_label);     }   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V557 Array overrun is possible. The value of &#8216;i&#8217; index could reach 7. itraqanalyzer.c 232<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u0443 \u043e\u0448\u0438\u0431\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c Copy-Paste. \u041d\u043e \u043f\u0443\u0441\u0442\u044c \u0443\u0436 \u0431\u0443\u0434\u0435\u0442 \u00ab\u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u00bb. \u0422\u0430\u043a \u0437\u0432\u0443\u0447\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0443\u0433\u0430\u044e\u0449\u0435. \u0414\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u044d\u0442\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u043e. \u041e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c, \u0432 \u0432\u0435\u0442\u043a\u0435 &#8216;else&#8217; \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 &#8216;CHANNELS_EIGHTPLEX&#8217;. \u041e\u0431 \u044d\u0442\u043e\u043c \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439:  <\/p>\n<pre><code class=\"cpp\">else \/\/ItraqQuantifier::EIGHTPLEX<\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430, \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 CHANNELS_FOURPLEX, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0437\u0434\u0435\u0441\u044c (\u0435\u0449\u0451 \u043e\u0434\u0438\u043d Copy-Paste): tmtanalyzer.c 225<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440.  <\/p>\n<pre><code class=\"cpp\">DoubleReal masse_[255]; \/\/\/&lt; mass table  EdwardsLippertIterator::EdwardsLippertIterator(const  EdwardsLippertIterator &amp; source) :   PepIterator(source),   f_file_(source.f_file_),   actual_pep_(source.actual_pep_),   spec_(source.spec_),   tol_(source.tol_),   is_at_end_(source.is_at_end_),   f_iterator_(source.f_iterator_),   f_entry_(source.f_entry_),   b_(source.b_),   e_(source.e_),   m_(source.m_),   massMax_(source.massMax_) {   for (Size i = 0; i &lt; 256; i++)   {     masse_[i] = source.masse_[i];   } }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V557 Array overrun is possible. The value of &#8216;i&#8217; index could reach 255. edwardslippertiterator.c 134<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c masse_. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 255 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0410 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f 256 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0446\u0438\u043a\u043b:  <\/p>\n<pre><code class=\"cpp\">for (Size i = 0; i &lt; 255; i++) {   masse_[i] = source.masse_[i]; }<\/code><\/pre>\n<p>  \u0410 \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b.<\/p>\n<h2>7. \u0423\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &#8216;new&#8217;<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">svm_problem * LibSVMEncoder::encodeLibSVMProblem(....) {   ....   node_vectors = new svm_node *[problem-&gt;l];   if (node_vectors == NULL)   {     delete[] problem-&gt;y;     delete problem;     return NULL;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V668 There is no sense in testing the &#8216;node_vectors&#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. libsvmencoder.c 177<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u00abif (node_vectors == NULL)\u00bb \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c, \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u043f\u0440\u043e\u0432\u0440\u0435\u043a\u0438:<\/p>\n<ul>\n<li>file_page.h 728<\/li>\n<li>libsvmencoder.c 160<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u042f \u0434\u0443\u043c\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e Cppcheck, Cpplint, \u043d\u043e PVS-Studio. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e. \u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u043c \u043d\u0430 <a href=\"mailto:support@viva64.com\">support@viva64.com<\/a>. \u041d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u043a\u043b\u044e\u0447, \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 OpenMS.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/pvs-studio\/blog\/192996\/\"> http:\/\/habrahabr.ru\/company\/pvs-studio\/blog\/192996\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" align=\"left\" src=\"http:\/\/habr.habrastorage.org\/post_images\/4a6\/1b7\/b5d\/4a61b7b5d6ed4b01e0ff89ce60710c0e.png\" alt=\"PVS-Studio, OpenMS\"\/> <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0433\u043e\u0440\u044f\u0447\u0438\u0445 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0439 \u043f\u0440\u043e &quot;<a href=\"http:\/\/habrahabr.ru\/company\/pvs-studio\/blog\/192624\/\">\u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440<\/a>&quot;, \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0449\u0451 \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439. \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0430\u0448\u043b\u043e\u0441\u044c, \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 OpenMS, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 protein mass spectrometry. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c Cppcheck. \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0435\u043d\u0441\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0436\u0434\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 PVS-Studio \u043f\u043e\u0441\u043b\u0435 Cppcheck. \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/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-192996","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/192996","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=192996"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/192996\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=192996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=192996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=192996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}