Newly introduced findings

List of Findings

Error: COMPILER_WARNING (CWE-9001): [#def1]
zstd-1.5.7/contrib/gen_html/gen_html.cpp:128:29: warning[-Wcomment]: ‘/*’ within comment
#  128 |         /* comments of type /**< and /*!< are detected and only function declaration is highlighted (bold) */
#  126|           }
#  127|   
#  128|->         /* comments of type /**< and /*!< are detected and only function declaration is highlighted (bold) */
#  129|           if ((line.find("/**<")!=string::npos || line.find("/*!<")!=string::npos) && line.find("*/")!=string::npos) {
#  130|               sout << "<pre><b>";

Error: COMPILER_WARNING (CWE-9001): [#def2]
zstd-1.5.7/contrib/gen_html/gen_html.cpp:128:38: warning[-Wcomment]: ‘/*’ within comment
#  126|           }
#  127|   
#  128|->         /* comments of type /**< and /*!< are detected and only function declaration is highlighted (bold) */
#  129|           if ((line.find("/**<")!=string::npos || line.find("/*!<")!=string::npos) && line.find("*/")!=string::npos) {
#  130|               sout << "<pre><b>";

Error: COMPILER_WARNING (CWE-9001): [#def3]
zstd-1.5.7/contrib/gen_html/gen_html.cpp:162:29: warning[-Wcomment]: ‘/*’ within comment
#  162 |         /* comments of type /*! mean: this is a function declaration; switch comments with declarations */
#  160|           while (!comments.empty() && comments[0].empty()) comments.erase(comments.begin()); // remove empty line at the start
#  161|   
#  162|->         /* comments of type /*! mean: this is a function declaration; switch comments with declarations */
#  163|           if (exclam == '!') {
#  164|               if (!comments.empty()) comments.erase(comments.begin()); /* remove first line like "ZSTD_XXX() :" */

Error: COMPILER_WARNING (CWE-9001): [#def4]
zstd-1.5.7/contrib/gen_html/gen_html.cpp:182:57: warning[-Wcomment]: ‘/*’ within comment
#  182 |         } else if (exclam == '=') { /* comments of type /*= and /**= mean: use a <H3> header and show also all functions until first empty line */
#  180|               }
#  181|               sout << "</p></pre><BR>" << endl << endl;
#  182|->         } else if (exclam == '=') { /* comments of type /*= and /**= mean: use a <H3> header and show also all functions until first empty line */
#  183|               trim(comments[0], " ");
#  184|               sout << "<h3>" << comments[0] << "</h3><pre>";

Error: COMPILER_WARNING (CWE-9001): [#def5]
zstd-1.5.7/contrib/gen_html/gen_html.cpp:182:65: warning[-Wcomment]: ‘/*’ within comment
#  180|               }
#  181|               sout << "</p></pre><BR>" << endl << endl;
#  182|->         } else if (exclam == '=') { /* comments of type /*= and /**= mean: use a <H3> header and show also all functions until first empty line */
#  183|               trim(comments[0], " ");
#  184|               sout << "<h3>" << comments[0] << "</h3><pre>";

Error: COMPILER_WARNING (CWE-9001): [#def6]
zstd-1.5.7/contrib/gen_html/gen_html.cpp:194:38: warning[-Wcomment]: ‘/*’ within comment
#  194 |         } else { /* comments of type /** and /*- mean: this is a comment; use a <H2> header for the first line */
#  192|               }
#  193|               sout << "</pre></b><BR>" << endl;
#  194|->         } else { /* comments of type /** and /*- mean: this is a comment; use a <H2> header for the first line */
#  195|               if (comments.empty()) continue;
#  196|   

Error: COMPILER_WARNING (CWE-9001): [#def7]
zstd-1.5.7/contrib/gen_html/gen_html.cpp:194:46: warning[-Wcomment]: ‘/*’ within comment
#  192|               }
#  193|               sout << "</pre></b><BR>" << endl;
#  194|->         } else { /* comments of type /** and /*- mean: this is a comment; use a <H2> header for the first line */
#  195|               if (comments.empty()) continue;
#  196|   

Error: COMPILER_WARNING (CWE-457): [#def8]
zstd-1.5.7/lib/legacy/zstd_v01.c:1496:5: warning[-Wmaybe-uninitialized]: ‘MEM <unsigned int> [(struct  *)&litbp]’ may be used uninitialized
# 1496 |     switch(litbp.blockType)
#      |     ^~~~~~
zstd-1.5.7/lib/legacy/zstd_v01.c: scope_hint: In function ‘ZSTD_decompressBlock’
zstd-1.5.7/lib/legacy/zstd_v01.c:1489:23: note: ‘MEM <unsigned int> [(struct  *)&litbp]’ was declared here
# 1489 |     blockProperties_t litbp;
#      |                       ^~~~~
# 1494|       ip += ZSTD_blockHeaderSize;
# 1495|   
# 1496|->     switch(litbp.blockType)
# 1497|       {
# 1498|       case bt_raw:

Error: COMPILER_WARNING (CWE-457): [#def9]
zstd-1.5.7/lib/legacy/zstd_v01.c:1505:20: warning[-Wmaybe-uninitialized]: ‘litbp.origSize’ may be used uninitialized
# 1505 |             size_t rleSize = litbp.origSize;
#      |                    ^~~~~~~
zstd-1.5.7/lib/legacy/zstd_v01.c: scope_hint: In function ‘ZSTD_decompressBlock’
zstd-1.5.7/lib/legacy/zstd_v01.c:1489:23: note: ‘litbp.origSize’ was declared here
# 1489 |     blockProperties_t litbp;
#      |                       ^~~~~
# 1503|       case bt_rle:
# 1504|           {
# 1505|->             size_t rleSize = litbp.origSize;
# 1506|               if (rleSize>maxDstSize) return ERROR(dstSize_tooSmall);
# 1507|               if (!srcSize) return ERROR(srcSize_wrong);

Error: COMPILER_WARNING (CWE-457): [#def10]
zstd-1.5.7/lib/legacy/zstd_v01.c:1850:35: warning[-Wmaybe-uninitialized]: ‘dumpsLength’ may be used uninitialized
# 1850 |         seqState.dumpsEnd = dumps + dumpsLength;
#      |                             ~~~~~~^~~~~~~~~~~~~
zstd-1.5.7/lib/legacy/zstd_v01.c: scope_hint: In function ‘ZSTD_decompressBlock’
zstd-1.5.7/lib/legacy/zstd_v01.c:1826:23: note: ‘dumpsLength’ was declared here
# 1826 |     size_t errorCode, dumpsLength;
#      |                       ^~~~~~~~~~~
# 1848|           memset(&sequence, 0, sizeof(sequence));
# 1849|           seqState.dumps = dumps;
# 1850|->         seqState.dumpsEnd = dumps + dumpsLength;
# 1851|           seqState.prevOffset = 1;
# 1852|           errorCode = FSE_initDStream(&(seqState.DStream), ip, iend-ip);

Error: COMPILER_WARNING (CWE-457): [#def11]
zstd-1.5.7/lib/legacy/zstd_v01.c:1850:35: warning[-Wmaybe-uninitialized]: ‘dumps’ may be used uninitialized
# 1850 |         seqState.dumpsEnd = dumps + dumpsLength;
#      |                             ~~~~~~^~~~~~~~~~~~~
zstd-1.5.7/lib/legacy/zstd_v01.c: scope_hint: In function ‘ZSTD_decompressBlock’
zstd-1.5.7/lib/legacy/zstd_v01.c:1830:17: note: ‘dumps’ was declared here
# 1830 |     const BYTE* dumps;
#      |                 ^~~~~
# 1848|           memset(&sequence, 0, sizeof(sequence));
# 1849|           seqState.dumps = dumps;
# 1850|->         seqState.dumpsEnd = dumps + dumpsLength;
# 1851|           seqState.prevOffset = 1;
# 1852|           errorCode = FSE_initDStream(&(seqState.DStream), ip, iend-ip);

Error: COMPILER_WARNING (CWE-457): [#def12]
zstd-1.5.7/lib/legacy/zstd_v01.c:1858:83: warning[-Wmaybe-uninitialized]: ‘nbSeq’ may be used uninitialized
# 1858 |         for ( ; (FSE_reloadDStream(&(seqState.DStream)) <= FSE_DStream_completed) && (nbSeq>0) ; )
#      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
zstd-1.5.7/lib/legacy/zstd_v01.c: scope_hint: In function ‘ZSTD_decompressBlock’
zstd-1.5.7/lib/legacy/zstd_v01.c:1829:9: note: ‘nbSeq’ was declared here
# 1829 |     int nbSeq;
#      |         ^~~~~
# 1856|           FSE_initDState(&(seqState.stateML), &(seqState.DStream), DTableML);
# 1857|   
# 1858|->         for ( ; (FSE_reloadDStream(&(seqState.DStream)) <= FSE_DStream_completed) && (nbSeq>0) ; )
# 1859|           {
# 1860|               size_t oneSeqSize;

Error: COMPILER_WARNING (CWE-457): [#def13]
zstd-1.5.7/lib/legacy/zstd_v01.c: scope_hint: In function ‘ZSTDv01_decompressDCtx’
zstd-1.5.7/lib/legacy/zstd_v01.c:1936:9: warning[-Wmaybe-uninitialized]: ‘MEM <unsigned int> [(struct  *)&blockProperties]’ may be used uninitialized
# 1936 |         switch(blockProperties.blockType)
#      |         ^~~~~~
zstd-1.5.7/lib/legacy/zstd_v01.c:1918:23: note: ‘MEM <unsigned int> [(struct  *)&blockProperties]’ was declared here
# 1918 |     blockProperties_t blockProperties;
#      |                       ^~~~~~~~~~~~~~~
# 1934|           if (blockSize > remainingSize) return ERROR(srcSize_wrong);
# 1935|   
# 1936|->         switch(blockProperties.blockType)
# 1937|           {
# 1938|           case bt_compressed:

Error: GCC_ANALYZER_WARNING (CWE-457): [#def14]
zstd-1.5.7/lib/legacy/zstd_v03.c:1527:13: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
zstd-1.5.7/lib/legacy/zstd_v03.c:3102:8: enter_function: entry to ‘ZSTDv03_decompressContinue’
zstd-1.5.7/lib/legacy/zstd_v03.c:3104:12: call_function: calling ‘ZSTD_decompressContinue’ from ‘ZSTDv03_decompressContinue’
# 1525|       for (n=0; n<oSize; n++)
# 1526|       {
# 1527|->         if (huffWeight[n] >= HUF_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
# 1528|           rankStats[huffWeight[n]]++;
# 1529|           weightTotal += (1 << huffWeight[n]) >> 1;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def15]
zstd-1.5.7/lib/legacy/zstd_v04.c:2328:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘Dtime[1]’
zstd-1.5.7/lib/legacy/zstd_v04.c:3591:8: enter_function: entry to ‘ZBUFFv04_decompressContinue’
zstd-1.5.7/lib/legacy/zstd_v04.c:3594:12: call_function: calling ‘ZBUFF_decompressContinue’ from ‘ZBUFFv04_decompressContinue’
# 2326|           Dtime[n] = algoTime[Q][n].tableTime + (algoTime[Q][n].decode256Time * D256);
# 2327|   
# 2328|->     Dtime[1] += Dtime[1] >> 4; Dtime[2] += Dtime[2] >> 3; /* advantage to algorithms using less memory, for cache eviction */
# 2329|   
# 2330|       if (Dtime[1] < Dtime[0]) algoNb = 1;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def16]
zstd-1.5.7/lib/legacy/zstd_v05.c:2111:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘rankValOrigin’
zstd-1.5.7/lib/legacy/zstd_v05.c:3686:8: enter_function: entry to ‘ZSTDv05_decompressBegin_usingDict’
zstd-1.5.7/lib/legacy/zstd_v05.c:3692:8: branch_true: following ‘true’ branch...
zstd-1.5.7/lib/legacy/zstd_v05.c:3693:21: branch_true: ...to here
zstd-1.5.7/lib/legacy/zstd_v05.c:3693:21: call_function: calling ‘ZSTDv05_decompress_insertDictionary’ from ‘ZSTDv05_decompressBegin_usingDict’
# 2109|       U32 s;
# 2110|   
# 2111|->     memcpy(rankVal, rankValOrigin, sizeof(rankVal));
# 2112|   
# 2113|       /* fill DTable */

Error: GCC_ANALYZER_WARNING (CWE-457): [#def17]
zstd-1.5.7/lib/legacy/zstd_v05.c:2211:33: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
zstd-1.5.7/lib/legacy/zstd_v05.c:3686:8: enter_function: entry to ‘ZSTDv05_decompressBegin_usingDict’
zstd-1.5.7/lib/legacy/zstd_v05.c:3692:8: branch_true: following ‘true’ branch...
zstd-1.5.7/lib/legacy/zstd_v05.c:3693:21: branch_true: ...to here
zstd-1.5.7/lib/legacy/zstd_v05.c:3693:21: call_function: calling ‘ZSTDv05_decompress_insertDictionary’ from ‘ZSTDv05_decompressBegin_usingDict’
# 2209|               U32* rankValPtr = rankVal[consumed];
# 2210|               for (w = 1; w <= maxW; w++) {
# 2211|->                 rankValPtr[w] = rankVal0[w] >> consumed;
# 2212|       }   }   }
# 2213|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def18]
zstd-1.5.7/lib/legacy/zstd_v07.c:2047:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘rankValOrigin’
zstd-1.5.7/lib/legacy/zstd_v07.c:4114:8: enter_function: entry to ‘ZSTDv07_decompressBegin_usingDict’
zstd-1.5.7/lib/legacy/zstd_v07.c:4119:8: branch_true: following ‘true’ branch...
zstd-1.5.7/lib/legacy/zstd_v07.c:4120:34: branch_true: ...to here
zstd-1.5.7/lib/legacy/zstd_v07.c:4120:34: call_function: calling ‘ZSTDv07_decompress_insertDictionary’ from ‘ZSTDv07_decompressBegin_usingDict’
# 2045|       U32 s;
# 2046|   
# 2047|->     memcpy(rankVal, rankValOrigin, sizeof(rankVal));
# 2048|   
# 2049|       /* fill DTable */

Error: GCC_ANALYZER_WARNING (CWE-457): [#def19]
zstd-1.5.7/lib/legacy/zstd_v07.c:2145:37: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
zstd-1.5.7/lib/legacy/zstd_v07.c:4114:8: enter_function: entry to ‘ZSTDv07_decompressBegin_usingDict’
zstd-1.5.7/lib/legacy/zstd_v07.c:4119:8: branch_true: following ‘true’ branch...
zstd-1.5.7/lib/legacy/zstd_v07.c:4120:34: branch_true: ...to here
zstd-1.5.7/lib/legacy/zstd_v07.c:4120:34: call_function: calling ‘ZSTDv07_decompress_insertDictionary’ from ‘ZSTDv07_decompressBegin_usingDict’
# 2143|                   U32 w;
# 2144|                   for (w = 1; w < maxW+1; w++) {
# 2145|->                     rankValPtr[w] = rankVal0[w] >> consumed;
# 2146|       }   }   }   }
# 2147|   

Error: GCC_ANALYZER_WARNING (CWE-479): [#def20]
zstd-1.5.7/programs/fileio.c:207:5: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘fprintf’ from within signal handler
zstd-1.5.7/programs/fileio.c:227:6: enter_function: entry to ‘FIO_addAbortHandler’
zstd-1.5.7/programs/fileio.c:192:13: enter_function: entry to ‘ABRThandler’
zstd-1.5.7/programs/fileio.c:207:5: danger: call to ‘fprintf’ from within signal handler
#  205|       }
#  206|   
#  207|->     DISPLAY("Caught %s signal, printing stack:\n", name);
#  208|       /* Retrieve current stack addresses. */
#  209|       addrlen = backtrace(addrlist, MAX_STACK_FRAMES);

Error: GCC_ANALYZER_WARNING (CWE-479): [#def21]
zstd-1.5.7/programs/fileio.c:218:9: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘fprintf’ from within signal handler
zstd-1.5.7/programs/fileio.c:227:6: enter_function: entry to ‘FIO_addAbortHandler’
zstd-1.5.7/programs/fileio.c:192:13: enter_function: entry to ‘ABRThandler’
zstd-1.5.7/programs/fileio.c:210:8: branch_false: following ‘false’ branch...
zstd-1.5.7/programs/fileio.c:215:18: branch_false: ...to here
zstd-1.5.7/programs/fileio.c:217:43: branch_true: following ‘true’ branch...
zstd-1.5.7/programs/fileio.c:218:9: branch_true: ...to here
zstd-1.5.7/programs/fileio.c:218:9: danger: call to ‘fprintf’ from within signal handler
#  216|       /* Print the stack trace, excluding calls handling the signal. */
#  217|       for (i = ZSTD_START_SYMBOLLIST_FRAME; i < addrlen; i++) {
#  218|->         DISPLAY("%s\n", symbollist[i]);
#  219|       }
#  220|       free(symbollist);

Error: GCC_ANALYZER_WARNING (CWE-479): [#def22]
zstd-1.5.7/programs/fileio.c:220:5: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘free’ from within signal handler
zstd-1.5.7/programs/fileio.c:227:6: enter_function: entry to ‘FIO_addAbortHandler’
zstd-1.5.7/programs/fileio.c:192:13: enter_function: entry to ‘ABRThandler’
zstd-1.5.7/programs/fileio.c:210:8: branch_false: following ‘false’ branch...
zstd-1.5.7/programs/fileio.c:215:18: branch_false: ...to here
zstd-1.5.7/programs/fileio.c:220:5: danger: call to ‘free’ from within signal handler
#  218|           DISPLAY("%s\n", symbollist[i]);
#  219|       }
#  220|->     free(symbollist);
#  221|       /* Reset and raise the signal so default handler runs. */
#  222|       signal(sig, SIG_DFL);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
zstd-1.5.7/programs/fileio_asyncio.c:173:27: warning[-Wanalyzer-malloc-leak]: leak of ‘ctx’
zstd-1.5.7/programs/fileio_asyncio.c:547:16: enter_function: entry to ‘AIO_ReadPool_create’
zstd-1.5.7/programs/fileio_asyncio.c:548:49: acquire_memory: allocated here
zstd-1.5.7/programs/fileio_asyncio.c:549:7: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
zstd-1.5.7/programs/fileio_asyncio.c:550:5: branch_false: ...to here
zstd-1.5.7/programs/fileio_asyncio.c:550:5: call_function: calling ‘AIO_IOPool_init’ from ‘AIO_ReadPool_create’
#  171|            * decompress into and 1 buffer that's actively written to disk and owned by the writing thread. */
#  172|           assert(MAX_IO_JOBS >= 2);
#  173|->         ctx->threadPool = POOL_create(1, MAX_IO_JOBS - 2);
#  174|           ctx->threadPoolActive = 1;
#  175|           if (!ctx->threadPool)

Error: COMPILER_WARNING (CWE-457): [#def24]
zstd-1.5.7/tests/fullbench.c: scope_hint: In function ‘prepLiterals’
zstd-1.5.7/tests/fullbench.c:189:12: warning[-Wmaybe-uninitialized]: ‘MEM <unsigned int> [(struct  *)&bp]’ may be used uninitialized
#  189 |         if (bp.blockType != bt_compressed) {
#      |            ^
zstd-1.5.7/tests/fullbench.c:187:27: note: ‘MEM <unsigned int> [(struct  *)&bp]’ was declared here
#  187 |     {   blockProperties_t bp;
#      |                           ^
#  187|       {   blockProperties_t bp;
#  188|           ZSTD_getcBlockSize((char*)dst+frameHeaderSize, dstCapacity, &bp);  /* Get 1st block type */
#  189|->         if (bp.blockType != bt_compressed) {
#  190|               DISPLAY("no compressed literals\n");
#  191|               return r;

Error: COMPILER_WARNING (CWE-457): [#def25]
zstd-1.5.7/tests/fullbench.c: scope_hint: In function ‘prepSequences1stBlock’
zstd-1.5.7/tests/fullbench.c:297:12: warning[-Wmaybe-uninitialized]: ‘MEM <unsigned int> [(struct  *)&bp]’ may be used uninitialized
#  297 |         if (bp.blockType != bt_compressed) {
#      |            ^
zstd-1.5.7/tests/fullbench.c:295:27: note: ‘MEM <unsigned int> [(struct  *)&bp]’ was declared here
#  295 |     {   blockProperties_t bp;
#      |                           ^
#  295|       {   blockProperties_t bp;
#  296|           size_t const cBlockSize = ZSTD_getcBlockSize(ip, dstCapacity, &bp);   /* Get 1st block type */
#  297|->         if (bp.blockType != bt_compressed) {
#  298|               DISPLAY("no compressed sequences\n");
#  299|               return r;

Error: CPPCHECK_WARNING (CWE-682): [#def26]
zstd-1.5.7/tests/fullbench.c:537: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  535|       size_t const prepCapacity = dstCapacity * 4;
#  536|       void* prepBuffer = malloc(prepCapacity);
#  537|->     void* sequencesStart = (char*)prepBuffer + 2*sizeof(unsigned);
#  538|       ZSTD_Sequence* const seqs = sequencesStart;
#  539|       size_t const seqsCapacity = prepCapacity / sizeof(ZSTD_Sequence);

Error: CPPCHECK_WARNING (CWE-682): [#def27]
zstd-1.5.7/tests/fullbench.c:579: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  577|       size_t const prepCapacity = dstCapacity * 4;
#  578|       void* prepBuffer = malloc(prepCapacity);
#  579|->     void* sequencesStart = (char*)prepBuffer + 3*sizeof(unsigned);
#  580|       ZSTD_Sequence* const seqs = sequencesStart;
#  581|       size_t const seqsCapacity = prepCapacity / sizeof(ZSTD_Sequence);

Error: CPPCHECK_WARNING (CWE-682): [#def28]
zstd-1.5.7/tests/fullbench.c:636: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  634|       size_t const prepCapacity = srcSize * 4;
#  635|       void* prepBuffer = malloc(prepCapacity);
#  636|->     void* sequencesStart = (char*)prepBuffer + 2*sizeof(unsigned);
#  637|       ZSTD_Sequence* const seqs = sequencesStart;
#  638|       size_t const seqsCapacity = prepCapacity / sizeof(ZSTD_Sequence);

Error: GCC_ANALYZER_WARNING (CWE-835): [#def29]
zstd-1.5.7/tests/fullbench.c:1146:20: warning[-Wanalyzer-infinite-loop]: infinite loop
zstd-1.5.7/tests/fullbench.c:1104:5: enter_function: entry to ‘main’
zstd-1.5.7/tests/fullbench.c:1146:20: danger: infinite loop here
zstd-1.5.7/tests/fullbench.c:1146:20: branch_true: if it ever follows ‘true’ branch, it will always do so...
zstd-1.5.7/tests/fullbench.c:1148:17: branch_true: ...to here
# 1144|           } else if (argument[0]=='-') { /* Commands (note : aggregated commands are allowed) */
# 1145|               argument++;
# 1146|->             while (argument[0]!=0) {
# 1147|   
# 1148|                   switch(argument[0])

Error: COMPILER_WARNING: [#def30]
zstd-1.5.7/tests/paramgrill.c: scope_hint: In function ‘createBuffers’
zstd-1.5.7/tests/paramgrill.c:1245:39: warning[-Wcalloc-transposed-args]: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument
# 1245 |     size_t* fileSizes = calloc(sizeof(size_t), nbFiles);
#      |                                       ^~~~~~
zstd-1.5.7/tests/paramgrill.c:1245:39: note: earlier argument should specify number of elements, later size of each element
# 1243|       size_t totalSizeToLoad = (size_t)UTIL_getTotalFileSize(fileNamesTable, (U32)nbFiles);
# 1244|       size_t benchedSize = MIN(BMK_findMaxMem(totalSizeToLoad * 3) / 3, totalSizeToLoad);
# 1245|->     size_t* fileSizes = calloc(sizeof(size_t), nbFiles);
# 1246|       void* srcBuffer = NULL;
# 1247|       int ret = 0;

Error: COMPILER_WARNING: [#def31]
zstd-1.5.7/tests/paramgrill.c: scope_hint: In function ‘createMemoTableArray’
zstd-1.5.7/tests/paramgrill.c:1460:60: warning[-Wcalloc-transposed-args]: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument
# 1460 |     memoTable_t* const mtAll = (memoTable_t*)calloc(sizeof(memoTable_t),(ZSTD_STRATEGY_MAX + 1));
#      |                                                            ^~~~~~~~~~~
zstd-1.5.7/tests/paramgrill.c:1460:60: note: earlier argument should specify number of elements, later size of each element
# 1458|                        const U32 memoTableLog)
# 1459|   {
# 1460|->     memoTable_t* const mtAll = (memoTable_t*)calloc(sizeof(memoTable_t),(ZSTD_STRATEGY_MAX + 1));
# 1461|       ZSTD_strategy i, stratMin = ZSTD_STRATEGY_MIN, stratMax = ZSTD_STRATEGY_MAX;
# 1462|   

Error: COMPILER_WARNING: [#def32]
zstd-1.5.7/tests/paramgrill.c:1497:47: warning[-Wcalloc-transposed-args]: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument
# 1497 |         mtAll[i].table = (BYTE*)calloc(sizeof(BYTE), mtl);
#      |                                               ^~~~
zstd-1.5.7/tests/paramgrill.c:1497:47: note: earlier argument should specify number of elements, later size of each element
# 1495|           }
# 1496|   
# 1497|->         mtAll[i].table = (BYTE*)calloc(sizeof(BYTE), mtl);
# 1498|           mtAll[i].tableLen = mtl;
# 1499|   

Error: COMPILER_WARNING (CWE-457): [#def33]
zstd-1.5.7/tests/paramgrill.c: scope_hint: In function ‘BMK_generate_cLevelTable’
zstd-1.5.7/tests/paramgrill.c:2018:61: warning[-Wmaybe-uninitialized]: ‘testResult.cSpeed’ may be used uninitialized
# 2018 |         BMK_init_level_constraints((int)((testResult.cSpeed * 31) / 32));
#      |                                                             ^
zstd-1.5.7/tests/paramgrill.c:2016:27: note: ‘testResult.cSpeed’ was declared here
# 2016 |         BMK_benchResult_t testResult;
#      |                           ^
# 2016|           BMK_benchResult_t testResult;
# 2017|           BMK_benchParam(&testResult, buf, ctx, l1params);
# 2018|->         BMK_init_level_constraints((int)((testResult.cSpeed * 31) / 32));
# 2019|       }
# 2020|   

Error: CPPCHECK_WARNING (CWE-457): [#def34]
zstd-1.5.7/tests/seqgen.c:38: error[uninitvar]: Uninitialized variables: stream.saved, stream.bytesLeft
#   36|       XXH64_reset(&stream.xxh, 0);
#   37|       stream.seed = seed;
#   38|->     return stream;
#   39|   }
#   40|   

Error: COMPILER_WARNING: [#def35]
zstd-1.5.7/tests/zstreamtest.c: scope_hint: In function ‘basicUnitTests’
zstd-1.5.7/tests/zstreamtest.c:1899:32: warning[-Wunterminated-string-initialization]: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (7 chars into 6 available)
# 1899 |           char testBuffer[6] = "\xAA\xAA\xAA\xAA\xAA\xAA";
#      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
# 1897|           /* Write a bunch of 6 byte blocks */
# 1898|           while (remainingInput > 0) {
# 1899|->           char testBuffer[6] = "\xAA\xAA\xAA\xAA\xAA\xAA";
# 1900|             const size_t kSmallBlockSize = sizeof(testBuffer);
# 1901|             ZSTD_inBuffer in = {testBuffer, kSmallBlockSize, 0};

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.90.0
diffbase-analyzer-version-cppcheck2.18.3
diffbase-analyzer-version-gcc15.2.1
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-161.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namezstd-1.5.7-2.fc43
diffbase-store-results-to/tmp/tmp1v7if93q/zstd-1.5.7-2.fc43.tar.xz
diffbase-time-created2025-10-28 20:45:21
diffbase-time-finished2025-10-28 20:50:55
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmp1v7if93q/zstd-1.5.7-2.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp1v7if93q/zstd-1.5.7-2.fc43.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-161.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-gcc-latest-x86_64
project-namezstd-1.5.7-3.fc44
store-results-to/tmp/tmp0yt2tcl4/zstd-1.5.7-3.fc44.tar.xz
time-created2025-10-28 20:51:32
time-finished2025-10-28 20:56:53
titleNewly introduced findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmp0yt2tcl4/zstd-1.5.7-3.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp0yt2tcl4/zstd-1.5.7-3.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9