{"id":471039,"date":"2025-08-17T15:01:02","date_gmt":"2025-08-17T15:01:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=471039"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=471039","title":{"rendered":"<span>MemorySanitizer (MSAN), \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0438 \u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u043e\u0446\u0435\u043d\u043a\u0430\u043c, \u0434\u043e 10% \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0430 C \u0438 C++ \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438: <a href=\"https:\/\/ieeexplore.ieee.org\/document\/11023423\" rel=\"noopener noreferrer nofollow\">1<\/a>, <a href=\"https:\/\/msrc.microsoft.com\/blog\/2020\/05\/solving-uninitialized-stack-memory-on-windows\/\" rel=\"noopener noreferrer nofollow\">2<\/a>). \u0417\u0430\u0434\u0430\u0447\u0430 <a href=\"https:\/\/clang.llvm.org\/docs\/MemorySanitizer.html\" rel=\"noopener noreferrer nofollow\">MemorySanitizer<\/a> (\u0434\u0430\u043b\u0435\u0435, MSAN) &#8212; \u0432\u044b\u044f\u0432\u043b\u044f\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043a\u043e\u0434\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u0443\u0441\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0431\u043b\u043e\u043a\u0435 \u043a\u043e\u0434\u0430 \u0442\u0438\u043f\u0430 <code>if (uninit_var) {...}<\/code>. \u041a\u0440\u043e\u043c\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u0430\u0451\u0442 \u043e \u0441\u0435\u0431\u0435 \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443, \u0441\u043c\u0435\u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (\u0438\u043b\u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u0438 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e), \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 &#171;\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e&#187; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0443\u043b\u044f\u043c\u0438, \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0443\u0441\u043e\u0440\u043e\u043c.<\/p>\n<p>MSAN \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 (\u043d\u0443\u0436\u043d\u044b \u0442\u0435\u0441\u0442\u044b\/fuzzing\/\u0440\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430). \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 MSAN, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e (\u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e?) \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0432\u0435\u0434\u044c \u0434\u0430\u0436\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0443\u043c\u0435\u044e\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0442\u044c \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0435\u0442\u044b\u0440\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 C \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">\/\/ trivial.c - \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440  int main(void) {     int x;     return x; }<\/code><\/pre>\n<pre><code class=\"cpp\">\/\/ prog1.c - \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439  int main(int argc, char** argv) {     int x;     if (argc % 2 == 0) {         x = 1;     }     return x; }<\/code><\/pre>\n<pre><code class=\"cpp\">\/\/ prog2.c - \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438  void func(int a, int *px) {     if (a % 2 == 0) {         *px = 1;     } }  int main(int argc, char** argv) {     int x;     func(argc, &amp;x);     return x; }<\/code><\/pre>\n<pre><code class=\"cpp\">\/\/ prog3.c - \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (\u0447\u0430\u0441\u0442\u0438) \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e memset  #include &lt;string.h&gt;  int main(int argc, char** argv) {     int arr[2];     memset(arr, 123, argc * sizeof(int));     return arr[1]; }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b (\u0433\u0434\u0435 &#8216;+&#8217; \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f) \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430) :<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\">prog3.c<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"left\">prog2.c<\/p>\n<\/td>\n<td>\n<p align=\"left\">prog1.c<\/p>\n<\/td>\n<td>\n<p align=\"left\">trivial.c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">gcc-14 -fanalyzer<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">clang-tidy-20<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CodeQL 2.22.3<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SonarScanner 7.2.0.5079<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">coverity 2024.12.1<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">pvs-studio 7.38.96703.605<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">infer 1.2.0<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">cppcheck 2.14.2<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">LLM Grok 4<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0414\u043b\u044f Grok 4 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u043c\u043f\u0442: &#171;\u0441\u0434\u0435\u043b\u0430\u0439 \u0440\u0435\u0432\u044c\u044e \u043a\u043e\u0434\u0430 &lt;\u043a\u043e\u0434 \u0446\u0435\u043b\u0438\u043a\u043e\u043c&gt;&#187; (\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e). \u0414\u043b\u044f prog3.c (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0438 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f) \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u0440\u0435\u0432\u044c\u044e \u0431\u044b\u043b\u043e: &#171;\u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445: \u0415\u0441\u043b\u0438 argc=1, \u0432\u043e\u0437\u0432\u0440\u0430\u0442 arr[1] \u2014 UB&#187;.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/test-msan1\/msan-guide\/tree\/main\/.github\/workflows\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. pvs-studio \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, sonarscanner \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u0438\u0437 sonarcloud (\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430), \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 coverity, \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u0438\u0435 \u0432\u0435\u043d\u0434\u043e\u0440\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 prog3.c, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0445\u043e\u0442\u044c \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u043a\u0430\u043a \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e <a href=\"https:\/\/googleprojectzero.blogspot.com\/2024\/10\/from-naptime-to-big-sleep.html\" rel=\"noopener noreferrer nofollow\">\u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f<\/a>, \u043a\u043e\u0433\u0434\u0430 \u043d\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b, \u043d\u0438 \u0441\u0430\u043d\u0438\u0442\u0430\u0439\u0437\u0435\u0440\u044b+\u0444\u0430\u0437\u0437\u0435\u0440\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 LLM \u043d\u0430\u0448\u043b\u0430. \u0421 \u0443\u0447\u0451\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e LLM \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u043e\u0431\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u0441\u0431\u043e\u0440\u043a\u0443 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0443\u0440\u0430\u0445 \u0438 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u044e\u0449\u0438\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043a\u043e\u0434\u0430 \u0432\u043e\u0432\u043d\u0435.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432, \u0447\u0435\u043c \u043e\u0434\u0438\u043d, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 gcc, clang-tidy, infer \u0438 cppcheck \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u041f\u041e.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c MSAN \u0434\u043b\u044f prog3.c (\u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e):<\/p>\n<pre><code class=\"bash\">$ clang-18 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -g prog3.c $ # \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441 argc=1 $ .\/a.out ==598446==WARNING: MemorySanitizer: use-of-uninitialized-value     #0 0x56309e09f4c2 in main \/t\/prog3.c:8:5     #1 0x7fd3646d91c9  (\/lib\/x86_64-linux-gnu\/libc.so.6+0x2a1c9) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)     #2 0x7fd3646d928a in __libc_start_main (\/lib\/x86_64-linux-gnu\/libc.so.6+0x2a28a) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)     #3 0x56309e0072f4 in _start (\/t\/a.out+0x322f4) (BuildId: 20024e12c800da970bc354adba16c0949483c67f)    Uninitialized value was created by an allocation of 'arr' in the stack frame     #0 0x56309e09f469 in main \/t\/prog3.c:6:5  SUMMARY: MemorySanitizer: use-of-uninitialized-value \/t\/prog3.c:8:5 in main Exiting $ # \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441 argc=2 $ .\/a.out 1 $ echo $? 123 <\/code><\/pre>\n<p>\u0418\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b MSAN \u043f\u0440\u0438\u043d\u0435\u0441 \u043f\u043e\u043b\u044c\u0437\u0443 \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u043f\u043e &#171;\u043f\u043b\u043e\u0445\u043e\u043c\u0443&#187; \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e, \u0442.\u0435. \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<h2>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN<\/h2>\n<ol>\n<li>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0438 \u041e\u0421. MSAN \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 llvm (clang) \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Linux, FreeBSD \u0438 NetBSD. \u0422.\u0435. \u0435\u0441\u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043f\u043e\u0434 Windows \u0438\u043b\u0438 MacOS \u0438 \u043a\u0440\u043e\u0441\u0441-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u0442\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MSAN \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u043f\u043e\u0434 \u043e\u0434\u043d\u0443 \u0438\u0437 \u044d\u0442\u0438\u0445 \u041e\u0421 \u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c clang<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0441 MSAN. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b libc \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f (llvm libc msan interceptors), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 libc \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getopt_long() \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e GNU extension, \u0430 \u043d\u0435 POSIX). \u0415\u0441\u043b\u0438 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e \u0438 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 getopt_long(), \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435 MSAN. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439 \u044f\u0432\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0432 getopt_long(), \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430 \u0440\u0430\u0434\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN. MSAN \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0441 glibc, \u0442\u0430\u043a \u0438 \u0441 musl (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0432 Alpine 3.22)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 C++ \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e LLVM libc++ \u0432\u043c\u0435\u0441\u0442\u043e GNU libstdc++ (\u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0435\u0449\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f). \u0412 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0435\u044f\u0432\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u0438\u0435, \u0430 \u0432 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 libc++.  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 libc++ \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 LLVM-19 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 (<a href=\"https:\/\/reviews.llvm.org\/D157058\" rel=\"noopener noreferrer nofollow\">\u0443\u0434\u0430\u043b\u0451\u043d<\/a>) std::basic_string&lt;unsigned char&gt;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 libstdc++. \u0422\u0430\u043a\u0436\u0435 libc++ \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0447\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f asm-\u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0442\u043e MSAN \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f __msan_unpoison() (<a href=\"https:\/\/github.com\/openssl\/openssl\/blob\/760929f6ba18952c052e92acb2f0c0163ab7720a\/crypto\/engine\/eng_rdrand.c#L23-L52\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u0432\u043d\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u044f\u0434\u0440\u043e\u043c), \u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f MSAN (<a href=\"https:\/\/github.com\/openssl\/openssl\/blob\/d6510d99ae4a8a23f54fdfb1473af6a920da8345\/engines\/e_afalg.c#L326-L333\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>)<\/p>\n<\/li>\n<li>\n<p>MSAN \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 (\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0441\u0445\u043e\u0434 \u043f\u0430\u043c\u044f\u0442\u0438), \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442 \u0441 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0441 msan) \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 cmake \u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f ctest. ctest \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442 libxml2 \u0438 openssl. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 libxml2, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 libxml2 \u0432 \/opt\/msan\/lib \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 LD_LIBRARY_PATH=\/opt\/msan\/lib .\/your_app, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0447\u0435\u0440\u0435\u0437 ctest \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 LD_LIBRARY_PATH=\/opt\/msan\/lib ctest, \u0442\u043e ctest \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u0438\u0442 msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 libxml2 \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 (\u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0441 msan) \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438\u043b\u0438 \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c rpath \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0434\u043e msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0435\u043d\u0434\u043e\u0440 \u041e\u0421 \u043d\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438  \u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443, \u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043a\u0430\u043a \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 (\u0447\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442 \u0432\u0435\u043d\u0434\u043e\u0440\u0430 \u041e\u0421, \u0430 \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e)<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 (\u0438\/\u0438\u043b\u0438 fuzzing)<\/p>\n<\/li>\n<\/ol>\n<h2>\u0414\u0435\u043c\u043e-\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c <a href=\"https:\/\/github.com\/test-msan1\/msan-guide\/tree\/main\/cxx-project\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a> \u043d\u0430 C++ \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c cmake \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438: \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 C++, openssl, libcppunittest \u0438 libcppunit (\u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432). \u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u0437 \u041e\u0421(\u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430). \u041f\u043b\u0430\u043d \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e apt source \u0432 ubuntu 24.04):<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c libc++ \u0441 MSAN<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">apt source libc++-18-dev cd llvm*\/ CC=clang-18 CXX=clang++-18 cmake -G Ninja -S runtimes -B build_libcxx \\    -DCMAKE_BUILD_TYPE=Release \\    -DLLVM_ENABLE_RUNTIMES=\"libcxx;libcxxabi\" \\    -DLLVM_USE_SANITIZER=Memory \\    -DLIBCXX_CXX_ABI=libcxxabi \\    -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \\    -DCMAKE_INSTALL_PREFIX=\/opt\/msan ninja -C build_libcxx install<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c openssl \u0441 MSAN (\u0442\u043e\u043b\u044c\u043a\u043e static library)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">apt source libssl-dev cd openssl*\/ CC=clang-18 \\   CFLAGS=\"-O2 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=memory\" \\   LDFLAGS=\"-fsanitize=memory\"  \\   .\/Configure no-shared no-asm no-threads no-zlib --prefix=\/opt\/msan make -j &amp;&amp; make install_sw<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c libcppunit \u0441 MSAN \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0439 libc++ \u0438 openssl<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">apt source libcppunit-dev cd cppunit*\/ PKG_CONFIG_LIBDIR=\"\/opt\/msan\/lib\/pkgconfig:\/opt\/msan\/lib64\/pkgconfig\" \\   CC=\"clang-18\" \\   CXX=\"clang++-18\" \\   CFLAGS=\"-O2 -g -fno-omit-frame-pointer -fsanitize=memory\" \\   CXXFLAGS=\"-O2  -g -fno-omit-frame-pointer -fsanitize=memory -I\/opt\/msan\/include\/c++\/v1 -stdlib=libc++\" \\   LDFLAGS=\"-fsanitize=memory -L\/opt\/msan\/lib -stdlib=libc++\" \\   .\/configure --prefix=\/opt\/msan<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">mkdir build &amp;&amp; cd build PKG_CONFIG_LIBDIR=\"\/opt\/msan\/lib\/pkgconfig:\/opt\/msan\/lib64\/pkgconfig\" \\   CXX=\"clang++-18\" \\   CXXFLAGS=\"-O2 -g -fno-omit-frame-pointer -fsanitize=memory -I\/opt\/msan\/include\/c++\/v1 -stdlib=libc++\" \\   LDFLAGS=\"-fsanitize=memory -L\/opt\/msan\/lib -stdlib=libc++\" \\   cmake .. make<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c LD_LIBRARY_PATH, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>LD_LIBRARY_PATH=\/opt\/msan\/lib ctest<\/code><\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 github workflow \u0434\u043b\u044f \u0434\u0435\u043c\u043e-\u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/test-msan1\/msan-guide\/blob\/3deb198c1e51f6fbdc593e60a91ac011c81be3e0\/.github\/workflows\/build-cxx-project-msan.yml\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h2>\u041c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 LLM (\u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0430\u0433\u0435\u043d\u0442\u0430)<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430, \u0432 Cursor (\u0442\u0430\u0440\u0438\u0444 Pro) \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u044b\u043b \u0437\u0430\u0434\u0430\u043d \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (\u0441\u0430\u043c \u043a\u043e\u0434 \u0441\u043b\u0435\u0433\u043a\u0430 \u0443\u0441\u043b\u043e\u0436\u043d\u0451\u043d \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a prog3.c):<\/p>\n<blockquote>\n<p>\u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434<\/p>\n<p>#include &lt;string.h&gt;<\/p>\n<p>int main(int argc, char** argv) {<br \/>    int arr[2];<br \/>    memset(arr, 123, (3 &#8212; argc) * sizeof(int));<br \/>    return arr[1];<br \/>}<\/p>\n<p>\u0442\u0432\u043e\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 MemorySanitizer \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0432\u043e\u0434\u0430 msan<\/p>\n<\/blockquote>\n<p>\u041d\u0435\u0439\u0440\u043e\u043d\u043a\u0430 &#171;\u043f\u043e\u0434\u0443\u043c\u0430\u043b\u0430&#187; \u0438 \u0432\u044b\u0434\u0430\u043b\u0430 \u0442\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442: &#171;\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u0438\u00a0argc &gt;= 2, \u043a\u043e\u0433\u0434\u0430\u00a0arr[1]\u00a0(\u0432\u0442\u043e\u0440\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442) \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u043d\u043e \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u00a0return arr[1].&#187;, \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0430\u0441\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e clang -fsanitize=memory, \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Cursor \u0431\u044b\u043b \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043d\u0430 MacOS, \u0434\u0430\u043b\u0435\u0435 \u0441\u0438\u043b\u0430\u043c\u0438 \u0418\u0418-\u0430\u0433\u0435\u043d\u0442\u0430 \u0431\u044b\u043b\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0430 \u0441 msan \u0432 docker \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u0447\u0442\u043e \u043f\u0440\u0438 argc=2 (\u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442) msan \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 (\u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0418\u0418 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u043e\u0433\u0430\u0434\u043a\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u0447\u0435\u043c \u0441\u0430\u043c\u043e\u043c\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u0434\u0435\u0439, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c\u0438<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<ol>\n<li>\n<p>\u041d\u0435 \u0432\u0441\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0415\u0441\u043b\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b (\u043d\u0430 \u0438\u0445 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e<\/p>\n<\/li>\n<li>\n<p>MSAN \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0435\u0441\u043b\u0438 &#171;\u043f\u043e\u0432\u0435\u0437\u0451\u0442&#187; \u0441 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, fuzzing, \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u043e\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 MSAN \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0440\u0443\u0434\u043e\u0451\u043c\u043a\u0438\u043c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0438\u0437-\u0437\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>LLM \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0442\u043e \u0447\u0442\u043e \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b. \u041b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0437\u0430 \u0441\u0447\u0435\u0442 \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0442\u043e\u0447\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0441\u0438\u043b\u0430\u043c\u0438 \u0441\u0430\u043c\u043e\u0439 LLM, \u0442.\u0435. \u043f\u0443\u0442\u0451\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 LLM \u0441 MSAN<\/p>\n<\/li>\n<\/ol>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ol>\n<li>\n<p><a href=\"https:\/\/static.googleusercontent.com\/media\/research.google.com\/hr\/\/pubs\/archive\/43308.pdf\" rel=\"noopener noreferrer nofollow\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0431\u043e\u0442\u044b MSAN<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/main\/llvm\/lib\/Transforms\/Instrumentation\/MemorySanitizer.cpp\" rel=\"noopener noreferrer nofollow\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430<\/a> \u0440\u0430\u0431\u043e\u0442\u044b MSAN \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 LLVM<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/457.html\" rel=\"noopener noreferrer nofollow\">CWE-457: Use of Uninitialized Variable<\/a><\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"https:\/\/gitlab.gnome.org\/GNOME\/libxml2\/-\/blob\/66f781cf385bf690892b48c181257841841d3d41\/.gitlab-ci.yml#L46-54\" rel=\"noopener noreferrer nofollow\">MSAN \u0432 CI<\/a> \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libxml2<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/937934\/\"> https:\/\/habr.com\/ru\/articles\/937934\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u043e\u0446\u0435\u043d\u043a\u0430\u043c, \u0434\u043e 10% \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0430 C \u0438 C++ \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438: <a href=\"https:\/\/ieeexplore.ieee.org\/document\/11023423\" rel=\"noopener noreferrer nofollow\">1<\/a>, <a href=\"https:\/\/msrc.microsoft.com\/blog\/2020\/05\/solving-uninitialized-stack-memory-on-windows\/\" rel=\"noopener noreferrer nofollow\">2<\/a>). \u0417\u0430\u0434\u0430\u0447\u0430 <a href=\"https:\/\/clang.llvm.org\/docs\/MemorySanitizer.html\" rel=\"noopener noreferrer nofollow\">MemorySanitizer<\/a> (\u0434\u0430\u043b\u0435\u0435, MSAN) &#8212; \u0432\u044b\u044f\u0432\u043b\u044f\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043a\u043e\u0434\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u0443\u0441\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0431\u043b\u043e\u043a\u0435 \u043a\u043e\u0434\u0430 \u0442\u0438\u043f\u0430 <code>if (uninit_var) {...}<\/code>. \u041a\u0440\u043e\u043c\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u0430\u0451\u0442 \u043e \u0441\u0435\u0431\u0435 \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443, \u0441\u043c\u0435\u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (\u0438\u043b\u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u0438 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e), \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 &#171;\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e&#187; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0443\u043b\u044f\u043c\u0438, \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0443\u0441\u043e\u0440\u043e\u043c.<\/p>\n<p>MSAN \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 (\u043d\u0443\u0436\u043d\u044b \u0442\u0435\u0441\u0442\u044b\/fuzzing\/\u0440\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430). \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 MSAN, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e (\u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e?) \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0432\u0435\u0434\u044c \u0434\u0430\u0436\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0443\u043c\u0435\u044e\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0442\u044c \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0435\u0442\u044b\u0440\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 C \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">\/\/ trivial.c - \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440  int main(void) {     int x;     return x; }<\/code><\/pre>\n<pre><code class=\"cpp\">\/\/ prog1.c - \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439  int main(int argc, char** argv) {     int x;     if (argc % 2 == 0) {         x = 1;     }     return x; }<\/code><\/pre>\n<pre><code class=\"cpp\">\/\/ prog2.c - \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438  void func(int a, int *px) {     if (a % 2 == 0) {         *px = 1;     } }  int main(int argc, char** argv) {     int x;     func(argc, &amp;x);     return x; }<\/code><\/pre>\n<pre><code class=\"cpp\">\/\/ prog3.c - \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (\u0447\u0430\u0441\u0442\u0438) \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e memset  #include &lt;string.h&gt;  int main(int argc, char** argv) {     int arr[2];     memset(arr, 123, argc * sizeof(int));     return arr[1]; }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b (\u0433\u0434\u0435 &#8216;+&#8217; \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f) \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430) :<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\">prog3.c<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"left\">prog2.c<\/p>\n<\/td>\n<td>\n<p align=\"left\">prog1.c<\/p>\n<\/td>\n<td>\n<p align=\"left\">trivial.c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">gcc-14 -fanalyzer<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">clang-tidy-20<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CodeQL 2.22.3<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SonarScanner 7.2.0.5079<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">coverity 2024.12.1<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">pvs-studio 7.38.96703.605<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">infer 1.2.0<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">cppcheck 2.14.2<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">LLM Grok 4<\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"139\" width=\"139\">\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>+<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0414\u043b\u044f Grok 4 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u043c\u043f\u0442: &#171;\u0441\u0434\u0435\u043b\u0430\u0439 \u0440\u0435\u0432\u044c\u044e \u043a\u043e\u0434\u0430 &lt;\u043a\u043e\u0434 \u0446\u0435\u043b\u0438\u043a\u043e\u043c&gt;&#187; (\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e). \u0414\u043b\u044f prog3.c (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0438 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f) \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u0440\u0435\u0432\u044c\u044e \u0431\u044b\u043b\u043e: &#171;\u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445: \u0415\u0441\u043b\u0438 argc=1, \u0432\u043e\u0437\u0432\u0440\u0430\u0442 arr[1] \u2014 UB&#187;.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/test-msan1\/msan-guide\/tree\/main\/.github\/workflows\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. pvs-studio \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, sonarscanner \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u0438\u0437 sonarcloud (\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430), \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 coverity, \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u0438\u0435 \u0432\u0435\u043d\u0434\u043e\u0440\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 prog3.c, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0445\u043e\u0442\u044c \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u043a\u0430\u043a \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e <a href=\"https:\/\/googleprojectzero.blogspot.com\/2024\/10\/from-naptime-to-big-sleep.html\" rel=\"noopener noreferrer nofollow\">\u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f<\/a>, \u043a\u043e\u0433\u0434\u0430 \u043d\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b, \u043d\u0438 \u0441\u0430\u043d\u0438\u0442\u0430\u0439\u0437\u0435\u0440\u044b+\u0444\u0430\u0437\u0437\u0435\u0440\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 LLM \u043d\u0430\u0448\u043b\u0430. \u0421 \u0443\u0447\u0451\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e LLM \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u043e\u0431\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u0441\u0431\u043e\u0440\u043a\u0443 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0443\u0440\u0430\u0445 \u0438 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u044e\u0449\u0438\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043a\u043e\u0434\u0430 \u0432\u043e\u0432\u043d\u0435.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432, \u0447\u0435\u043c \u043e\u0434\u0438\u043d, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 gcc, clang-tidy, infer \u0438 cppcheck \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u041f\u041e.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c MSAN \u0434\u043b\u044f prog3.c (\u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e):<\/p>\n<pre><code class=\"bash\">$ clang-18 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -g prog3.c $ # \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441 argc=1 $ .\/a.out ==598446==WARNING: MemorySanitizer: use-of-uninitialized-value     #0 0x56309e09f4c2 in main \/t\/prog3.c:8:5     #1 0x7fd3646d91c9  (\/lib\/x86_64-linux-gnu\/libc.so.6+0x2a1c9) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)     #2 0x7fd3646d928a in __libc_start_main (\/lib\/x86_64-linux-gnu\/libc.so.6+0x2a28a) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)     #3 0x56309e0072f4 in _start (\/t\/a.out+0x322f4) (BuildId: 20024e12c800da970bc354adba16c0949483c67f)    Uninitialized value was created by an allocation of 'arr' in the stack frame     #0 0x56309e09f469 in main \/t\/prog3.c:6:5  SUMMARY: MemorySanitizer: use-of-uninitialized-value \/t\/prog3.c:8:5 in main Exiting $ # \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441 argc=2 $ .\/a.out 1 $ echo $? 123 <\/code><\/pre>\n<p>\u0418\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b MSAN \u043f\u0440\u0438\u043d\u0435\u0441 \u043f\u043e\u043b\u044c\u0437\u0443 \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u043f\u043e &#171;\u043f\u043b\u043e\u0445\u043e\u043c\u0443&#187; \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e, \u0442.\u0435. \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<h2>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN<\/h2>\n<ol>\n<li>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0438 \u041e\u0421. MSAN \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 llvm (clang) \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Linux, FreeBSD \u0438 NetBSD. \u0422.\u0435. \u0435\u0441\u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043f\u043e\u0434 Windows \u0438\u043b\u0438 MacOS \u0438 \u043a\u0440\u043e\u0441\u0441-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u0442\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MSAN \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u043f\u043e\u0434 \u043e\u0434\u043d\u0443 \u0438\u0437 \u044d\u0442\u0438\u0445 \u041e\u0421 \u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c clang<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0441 MSAN. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b libc \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f (llvm libc msan interceptors), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 libc \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getopt_long() \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e GNU extension, \u0430 \u043d\u0435 POSIX). \u0415\u0441\u043b\u0438 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e \u0438 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 getopt_long(), \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435 MSAN. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439 \u044f\u0432\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0432 getopt_long(), \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430 \u0440\u0430\u0434\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN. MSAN \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0441 glibc, \u0442\u0430\u043a \u0438 \u0441 musl (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0432 Alpine 3.22)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 C++ \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e LLVM libc++ \u0432\u043c\u0435\u0441\u0442\u043e GNU libstdc++ (\u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0435\u0449\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f). \u0412 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0435\u044f\u0432\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u0438\u0435, \u0430 \u0432 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 libc++.  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 libc++ \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 LLVM-19 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 (<a href=\"https:\/\/reviews.llvm.org\/D157058\" rel=\"noopener noreferrer nofollow\">\u0443\u0434\u0430\u043b\u0451\u043d<\/a>) std::basic_string&lt;unsigned char&gt;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 libstdc++. \u0422\u0430\u043a\u0436\u0435 libc++ \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0447\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f asm-\u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0442\u043e MSAN \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f __msan_unpoison() (<a href=\"https:\/\/github.com\/openssl\/openssl\/blob\/760929f6ba18952c052e92acb2f0c0163ab7720a\/crypto\/engine\/eng_rdrand.c#L23-L52\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u0432\u043d\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u044f\u0434\u0440\u043e\u043c), \u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u043b\u043e\u0436\u043d\u043e\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f MSAN (<a href=\"https:\/\/github.com\/openssl\/openssl\/blob\/d6510d99ae4a8a23f54fdfb1473af6a920da8345\/engines\/e_afalg.c#L326-L333\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>)<\/p>\n<\/li>\n<li>\n<p>MSAN \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 (\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0441\u0445\u043e\u0434 \u043f\u0430\u043c\u044f\u0442\u0438), \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442 \u0441 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0441 msan) \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 cmake \u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f ctest. ctest \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442 libxml2 \u0438 openssl. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 libxml2, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 libxml2 \u0432 \/opt\/msan\/lib \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 LD_LIBRARY_PATH=\/opt\/msan\/lib .\/your_app, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0447\u0435\u0440\u0435\u0437 ctest \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 LD_LIBRARY_PATH=\/opt\/msan\/lib ctest, \u0442\u043e ctest \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u0438\u0442 msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 libxml2 \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 (\u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0441 msan) \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438\u043b\u0438 \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c rpath \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0434\u043e msan-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0435\u043d\u0434\u043e\u0440 \u041e\u0421 \u043d\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438  \u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443, \u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043a\u0430\u043a \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 (\u0447\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442 \u0432\u0435\u043d\u0434\u043e\u0440\u0430 \u041e\u0421, \u0430 \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e)<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 (\u0438\/\u0438\u043b\u0438 fuzzing)<\/p>\n<\/li>\n<\/ol>\n<h2>\u0414\u0435\u043c\u043e-\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c <a href=\"https:\/\/github.com\/test-msan1\/msan-guide\/tree\/main\/cxx-project\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a> \u043d\u0430 C++ \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c cmake \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438: \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 C++, openssl, libcppunittest \u0438 libcppunit (\u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432). \u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u0437 \u041e\u0421(\u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430). \u041f\u043b\u0430\u043d \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f MSAN \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e apt source \u0432 ubuntu 24.04):<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c libc++ \u0441 MSAN<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">apt source libc++-18-dev cd llvm*\/ CC=clang-18 CXX=clang++-18 cmake -G Ninja -S runtimes -B build_libcxx \\    -DCMAKE_BUILD_TYPE=Release \\    -DLLVM_ENABLE_RUNTIMES=\"libcxx;libcxxabi\" \\    -DLLVM_USE_SANITIZER=Memory \\    -DLIBCXX_CXX_ABI=libcxxabi \\    -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \\    -DCMAKE_INSTALL_PREFIX=\/opt\/msan ninja -C build_libcxx install<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c openssl \u0441 MSAN (\u0442\u043e\u043b\u044c\u043a\u043e static library)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">apt source libssl-dev cd openssl*\/ CC=clang-18 \\   CFLAGS=\"-O2 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=memory\" \\   LDFLAGS=\"-fsanitize=memory\"  \\   .\/Configure no-shared no-asm no-threads no-zlib --prefix=\/opt\/msan make -j &amp;&amp; make install_sw<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c libcppunit \u0441 MSAN \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0439 libc++ \u0438 openssl<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">apt source libcppunit-dev cd cppunit*\/ PKG_CONFIG_LIBDIR=\"\/opt\/msan\/lib\/pkgconfig:\/opt\/msan\/lib64\/pkgconfig\" \\   CC=\"clang-18\" \\   CXX=\"clang++-18\" \\   CFLAGS=\"-O2 -g -fno-omit-frame-pointer -fsanitize=memory\" \\   CXXFLAGS=\"-O2  -g -fno-omit-frame-pointer -fsanitize=memory -I\/opt\/msan\/include\/c++\/v1 -stdlib=libc++\" \\   LDFLAGS=\"-fsanitize=memory -L\/opt\/msan\/lib -stdlib=libc++\" \\   .\/configure --prefix=\/opt\/msan<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">mkdir build &amp;&amp; cd build PKG_CONFIG_LIBDIR=\"\/opt\/msan\/lib\/pkgconfig:\/opt\/msan\/lib64\/pkgconfig\" \\   CXX=\"clang++-18\" \\   CXXFLAGS=\"-O2 -g -fno-omit-frame-pointer -fsanitize=memory -I\/opt\/msan\/include\/c++\/v1 -stdlib=libc++\" \\<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-471039","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471039","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=471039"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471039\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=471039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=471039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=471039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}