zstd-1.5.6-1.fc41

List of Defects

Error: CLANG_WARNING: [#def1]
zstd-1.5.6/lib/compress/zstd_compress_sequences.c:14: included_from: Included from here.
zstd-1.5.6/lib/compress/zstd_compress_sequences.h:15: included_from: Included from here.
zstd-1.5.6/lib/common/zstd_internal.h:30: included_from: Included from here.
zstd-1.5.6/lib/common/fse.h:237: included_from: Included from here.
zstd-1.5.6/lib/common/bitstream.h:172:25: warning[core.UndefinedBinaryOperatorResult]: The right operand of '&' is a garbage value due to array index out of bounds
#  170|   #else
#  171|       assert(nbBits < BIT_MASK_SIZE);
#  172|->     return bitContainer & BIT_mask[nbBits];
#  173|   #endif
#  174|   }

Error: CPPCHECK_WARNING (CWE-457): [#def2]
zstd-1.5.6/lib/compress/zstd_compress.c:2797: error[uninitvar]: Uninitialized variables: stats.Offtype, stats.MLtype
# 2795|                   DEBUGLOG(3, "ZSTD_buildCTable for LitLens failed");
# 2796|                   stats.size = countSize;
# 2797|->                 return stats;
# 2798|               }
# 2799|               if (stats.LLtype == set_compressed)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def3]
zstd-1.5.6/lib/compress/zstd_compress.c: scope_hint: In function ‘ZSTD_buildSequencesStatistics’
zstd-1.5.6/lib/compress/zstd_compress.c:2797:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘stats.Offtype’
zstd-1.5.6/lib/common/bitstream.h:32: included_from: Included from here.
zstd-1.5.6/lib/common/fse.h:237: included_from: Included from here.
zstd-1.5.6/lib/compress/zstd_compress.c:19: included_from: Included from here.
zstd-1.5.6/lib/compress/zstd_compress.c:4680:5: note: in expansion of macro ‘RETURN_ERROR_IF’
zstd-1.5.6/lib/compress/zstd_compress.c: scope_hint: In function ‘ZSTD_buildSequencesStatistics’
zstd-1.5.6/lib/compress/zstd_compress.c:3250:13: note: in expansion of macro ‘RETURN_ERROR_IF’
zstd-1.5.6/lib/compress/zstd_compress.c:4336:9: note: in expansion of macro ‘FORWARD_IF_ERROR’
zstd-1.5.6/lib/compress/zstd_compress.c:2924:9: note: in expansion of macro ‘FORWARD_IF_ERROR’
zstd-1.5.6/lib/compress/zstd_compress.c:2930:5: note: in expansion of macro ‘RETURN_ERROR_IF’
# 2795|                   DEBUGLOG(3, "ZSTD_buildCTable for LitLens failed");
# 2796|                   stats.size = countSize;
# 2797|->                 return stats;
# 2798|               }
# 2799|               if (stats.LLtype == set_compressed)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def4]
zstd-1.5.6/lib/compress/zstd_compress.c:2829:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘stats.MLtype’
zstd-1.5.6/lib/compress/zstd_compress.c:4680:5: note: in expansion of macro ‘RETURN_ERROR_IF’
zstd-1.5.6/lib/compress/zstd_compress.c: scope_hint: In function ‘ZSTD_buildSequencesStatistics’
zstd-1.5.6/lib/compress/zstd_compress.c:3250:13: note: in expansion of macro ‘RETURN_ERROR_IF’
zstd-1.5.6/lib/compress/zstd_compress.c:4336:9: note: in expansion of macro ‘FORWARD_IF_ERROR’
zstd-1.5.6/lib/compress/zstd_compress.c:2924:9: note: in expansion of macro ‘FORWARD_IF_ERROR’
zstd-1.5.6/lib/compress/zstd_compress.c:2930:5: note: in expansion of macro ‘RETURN_ERROR_IF’
# 2827|                   DEBUGLOG(3, "ZSTD_buildCTable for Offsets failed");
# 2828|                   stats.size = countSize;
# 2829|->                 return stats;
# 2830|               }
# 2831|               if (stats.Offtype == set_compressed)

Error: CLANG_WARNING: [#def5]
zstd-1.5.6/lib/compress/zstd_compress_superblock.c:611:13: warning[deadcode.DeadStores]: Value stored to 'lp' is never read
#  609|               assert(ip + decompressedSize <= iend);
#  610|               ip += decompressedSize;
#  611|->             lp += litSize;
#  612|               op += cSize;
#  613|               llCodePtr += seqCount;

Error: CLANG_WARNING: [#def6]
zstd-1.5.6/lib/compress/zstd_compress_superblock.c:613:13: warning[deadcode.DeadStores]: Value stored to 'llCodePtr' is never read
#  611|               lp += litSize;
#  612|               op += cSize;
#  613|->             llCodePtr += seqCount;
#  614|               mlCodePtr += seqCount;
#  615|               ofCodePtr += seqCount;

Error: CLANG_WARNING: [#def7]
zstd-1.5.6/lib/compress/zstd_compress_superblock.c:614:13: warning[deadcode.DeadStores]: Value stored to 'mlCodePtr' is never read
#  612|               op += cSize;
#  613|               llCodePtr += seqCount;
#  614|->             mlCodePtr += seqCount;
#  615|               ofCodePtr += seqCount;
#  616|               /* Entropy only needs to be written once */

Error: CLANG_WARNING: [#def8]
zstd-1.5.6/lib/compress/zstd_compress_superblock.c:615:13: warning[deadcode.DeadStores]: Value stored to 'ofCodePtr' is never read
#  613|               llCodePtr += seqCount;
#  614|               mlCodePtr += seqCount;
#  615|->             ofCodePtr += seqCount;
#  616|               /* Entropy only needs to be written once */
#  617|               if (litEntropyWritten) {

Error: CLANG_WARNING: [#def9]
zstd-1.5.6/lib/compress/zstd_ldm.c:56:35: warning[core.BitwiseShift]: Left shift overflows the capacity of 'U64'
#   54|       } else {
#   55|           /* In this degenerate case we simply honor the hash rate. */
#   56|->         state->stopMask = ((U64)1 << hashRateLog) - 1;
#   57|       }
#   58|   }

Error: CLANG_WARNING: [#def10]
zstd-1.5.6/lib/compress/zstd_opt.c:1373:17: warning[deadcode.DeadStores]: Value stored to 'storeStart' during its initialization is never read
# 1371|            */
# 1372|           {   U32 const storeEnd = cur + 2;
# 1373|->             U32 storeStart = storeEnd;
# 1374|               U32 stretchPos = cur;
# 1375|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
zstd-1.5.6/lib/compress/zstdmt_compress.c: scope_hint: In function ‘ZSTDMT_getBuffer’
zstd-1.5.6/lib/compress/zstdmt_compress.c:224:16: warning[-Wanalyzer-malloc-leak]: leak of ‘<return-value>.start’
zstd-1.5.6/lib/compress/zstd_compress_internal.h:21: included_from: Included from here.
zstd-1.5.6/lib/compress/zstdmt_compress.c:24: included_from: Included from here.
zstd-1.5.6/lib/common/zstd_internal.h:58:24: note: in definition of macro ‘MIN’
zstd-1.5.6/lib/compress/zstdmt_compress.c:19: included_from: Included from here.
zstd-1.5.6/lib/common/allocations.h:15: included_from: Included from here.
zstd-1.5.6/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’
zstd-1.5.6/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’
#  222|               DEBUGLOG(5, "ZSTDMT_getBuffer: created buffer of size %u", (U32)bSize);
#  223|           }
#  224|->         return buffer;
#  225|       }
#  226|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
zstd-1.5.6/lib/compress/zstdmt_compress.c:224:16: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
zstd-1.5.6/lib/common/zstd_internal.h:26: included_from: Included from here.
zstd-1.5.6/lib/common/error_private.h:153:34: note: in definition of macro ‘FORWARD_IF_ERROR’
zstd-1.5.6/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’
zstd-1.5.6/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’
#  222|               DEBUGLOG(5, "ZSTDMT_getBuffer: created buffer of size %u", (U32)bSize);
#  223|           }
#  224|->         return buffer;
#  225|       }
#  226|   }

Error: GCC_ANALYZER_WARNING (CWE-835): [#def13]
zstd-1.5.6/lib/compress/zstdmt_compress.c: scope_hint: In function ‘ZSTDMT_waitForAllJobsCompleted’
zstd-1.5.6/lib/compress/zstdmt_compress.c:1019:27: warning[-Wanalyzer-infinite-loop]: infinite loop
# 1017|           unsigned const jobID = mtctx->doneJobID & mtctx->jobIDMask;
# 1018|           ZSTD_PTHREAD_MUTEX_LOCK(&mtctx->jobs[jobID].job_mutex);
# 1019|->         while (mtctx->jobs[jobID].consumed < mtctx->jobs[jobID].src.size) {
# 1020|               DEBUGLOG(4, "waiting for jobCompleted signal from job %u", mtctx->doneJobID);   /* we want to block when waiting for data to flush */
# 1021|               ZSTD_pthread_cond_wait(&mtctx->jobs[jobID].job_cond, &mtctx->jobs[jobID].job_mutex);

Error: GCC_ANALYZER_WARNING (CWE-835): [#def14]
zstd-1.5.6/lib/compress/zstdmt_compress.c: scope_hint: In function ‘ZSTDMT_flushProduced’
zstd-1.5.6/lib/compress/zstdmt_compress.c:1463:27: warning[-Wanalyzer-infinite-loop]: infinite loop
# 1461|         && (mtctx->doneJobID < mtctx->nextJobID) ) {
# 1462|           assert(mtctx->jobs[wJobID].dstFlushed <= mtctx->jobs[wJobID].cSize);
# 1463|->         while (mtctx->jobs[wJobID].dstFlushed == mtctx->jobs[wJobID].cSize) {  /* nothing to flush */
# 1464|               if (mtctx->jobs[wJobID].consumed == mtctx->jobs[wJobID].src.size) {
# 1465|                   DEBUGLOG(5, "job %u is completely consumed (%u == %u) => don't wait for cond, there will be none",

Error: CPPCHECK_WARNING (CWE-457): [#def15]
zstd-1.5.6/lib/decompress/zstd_decompress.c:729: error[uninitvar]: Uninitialized variable: frameSizeInfo.nbBlocks
#  727|       frameSizeInfo.compressedSize = ret;
#  728|       frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR;
#  729|->     return frameSizeInfo;
#  730|   }
#  731|   

Error: GCC_ANALYZER_WARNING (CWE-835): [#def16]
zstd-1.5.6/lib/dictBuilder/cover.c: scope_hint: In function ‘COVER_best_wait.part.0’
zstd-1.5.6/lib/dictBuilder/cover.c:873:14: warning[-Wanalyzer-infinite-loop]: infinite loop
#  871|     }
#  872|     ZSTD_pthread_mutex_lock(&best->mutex);
#  873|->   while (best->liveJobs != 0) {
#  874|       ZSTD_pthread_cond_wait(&best->cond, &best->mutex);
#  875|     }

Error: GCC_ANALYZER_WARNING (CWE-457): [#def17]
zstd-1.5.6/lib/dictBuilder/cover.c: scope_hint: In function ‘COVER_selectDict’
zstd-1.5.6/lib/dictBuilder/cover.c:998:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘customDictContent’
zstd-1.5.6/lib/dictBuilder/cover.c:72:30: note: in expansion of macro ‘LOCALDISPLAYLEVEL’
zstd-1.5.6/lib/dictBuilder/cover.c:734:3: note: in expansion of macro ‘DISPLAYLEVEL’
#  996|   
#  997|     /* Initial dictionary size and compressed size */
#  998|->   memcpy(largestDictbuffer, customDictContent, dictContentSize);
#  999|     dictContentSize = ZDICT_finalizeDictionary(
# 1000|       largestDictbuffer, dictBufferCapacity, customDictContent, dictContentSize,

Error: CLANG_WARNING: [#def18]
zstd-1.5.6/lib/dictBuilder/divsufsort.c:1229:11: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 1227|         } else if(limit == -2) {
# 1228|           /* tandem repeat copy */
# 1229|->         a = stack[--ssize].b, b = stack[ssize].c;
# 1230|           if(stack[ssize].d == 0) {
# 1231|             tr_copy(ISA, SA, first, a, b, last, ISAd - ISA);

Error: CLANG_WARNING: [#def19]
zstd-1.5.6/lib/dictBuilder/divsufsort.c:1641:16: warning[core.NullDereference]: Dereference of null pointer
# 1639|             }
# 1640|             assert(k < j); assert(k != NULL);
# 1641|->           *k-- = s;
# 1642|           } else {
# 1643|             assert(((s == 0) && (T[s] == c1)) || (s < 0));

Error: CLANG_WARNING: [#def20]
zstd-1.5.6/lib/dictBuilder/divsufsort.c:1705:16: warning[core.NullDereference]: Dereference of null pointer
# 1703|             }
# 1704|             assert(k < j); assert(k != NULL);
# 1705|->           *k-- = s;
# 1706|           } else if(s != 0) {
# 1707|             *j = ~s;

Error: CLANG_WARNING: [#def21]
zstd-1.5.6/lib/dictBuilder/divsufsort.c:1789:16: warning[core.NullDereference]: Dereference of null pointer
# 1787|             }
# 1788|             assert(k < j); assert(k != NULL);
# 1789|->           *k-- = s;
# 1790|           } else if(s != 0) {
# 1791|             *j = ~s;

Error: CLANG_WARNING: [#def22]
zstd-1.5.6/lib/legacy/zstd_v06.c:482:57: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  480|   *  Shared functions to include for inlining
#  481|   *********************************************/
#  482|-> static void ZSTDv06_copy8(void* dst, const void* src) { memcpy(dst, src, 8); }
#  483|   #define COPY8(d,s) { ZSTDv06_copy8(d,s); d+=8; s+=8; }
#  484|   

Error: CLANG_WARNING: [#def23]
zstd-1.5.6/lib/legacy/zstd_v06.c:3339:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 3337|           match = dictEnd - (base-match);
# 3338|           if (match + sequence.matchLength <= dictEnd) {
# 3339|->             memmove(oLitEnd, match, sequence.matchLength);
# 3340|               return sequenceLength;
# 3341|           }

Error: CLANG_WARNING: [#def24]
zstd-1.5.6/lib/legacy/zstd_v06.c:3344:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 3342|           /* span extDict & currentPrefixSegment */
# 3343|           {   size_t const length1 = dictEnd - match;
# 3344|->             memmove(oLitEnd, match, length1);
# 3345|               op = oLitEnd + length1;
# 3346|               sequence.matchLength -= length1;

Error: CLANG_WARNING: [#def25]
zstd-1.5.6/lib/legacy/zstd_v06.c:3361:17: warning[core.NullDereference]: Array access (from variable 'match') results in a null pointer dereference
# 3359|           static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
# 3360|           int const sub2 = dec64table[sequence.offset];
# 3361|->         op[0] = match[0];
# 3362|           op[1] = match[1];
# 3363|           op[2] = match[2];

Error: CLANG_WARNING: [#def26]
zstd-1.5.6/lib/legacy/zstd_v06.c:3455:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 3453|           if (op+lastLLSize > oend) return ERROR(dstSize_tooSmall);
# 3454|           if (lastLLSize > 0) {
# 3455|->             memcpy(op, litPtr, lastLLSize);
# 3456|               op += lastLLSize;
# 3457|           }

Error: CPPCHECK_WARNING (CWE-457): [#def27]
zstd-1.5.6/programs/benchfn.c:97: error[uninitvar]: Uninitialized variable: outcome.error_result_never_ever_use_directly
#   95|       outcome.error_tag_never_ever_use_directly = 0;
#   96|       outcome.internal_never_ever_use_directly = runTime;
#   97|->     return outcome;
#   98|   }
#   99|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def28]
zstd-1.5.6/programs/benchfn.c:97:12: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘outcome.error_result_never_ever_use_directly’
zstd-1.5.6/programs/benchfn.c: scope_hint: In function ‘BMK_benchFunction’
#   95|       outcome.error_tag_never_ever_use_directly = 0;
#   96|       outcome.internal_never_ever_use_directly = runTime;
#   97|->     return outcome;
#   98|   }
#   99|   

Error: GCC_ANALYZER_WARNING (CWE-126): [#def29]
zstd-1.5.6/programs/benchzstd.c:78:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
zstd-1.5.6/programs/benchzstd.c:83:9: note: in expansion of macro ‘DISPLAY’
zstd-1.5.6/programs/benchzstd.c:1064:13: note: in expansion of macro ‘DISPLAYLEVEL’
zstd-1.5.6/programs/benchzstd.c:1064:13: note: in expansion of macro ‘DISPLAYLEVEL’
zstd-1.5.6/programs/benchzstd.c:1064:13: note: in expansion of macro ‘DISPLAYLEVEL’
zstd-1.5.6/programs/benchzstd.c:83:9: note: in expansion of macro ‘DISPLAY’
zstd-1.5.6/programs/benchzstd.c:1064:13: note: in expansion of macro ‘DISPLAYLEVEL’
zstd-1.5.6/programs/benchzstd.c:83:9: note: in expansion of macro ‘DISPLAY’
zstd-1.5.6/programs/benchzstd.c:1064:13: note: in expansion of macro ‘DISPLAYLEVEL’
zstd-1.5.6/programs/benchzstd.c:78:9: note: read of 8 bytes from after the end of ‘dictFileName’
zstd-1.5.6/programs/benchzstd.c:83:9: note: in expansion of macro ‘DISPLAY’
zstd-1.5.6/programs/benchzstd.c:1064:13: note: in expansion of macro ‘DISPLAYLEVEL’
#                                         └──────────────────────────────────────┘
#                                                            ^
#   76|   #define DISPLAY(...)                  \
#   77|       {                                 \
#   78|->         fprintf(stderr, __VA_ARGS__); \
#   79|           fflush(NULL);                 \
#   80|       }

Error: GCC_ANALYZER_WARNING (CWE-126): [#def30]
zstd-1.5.6/programs/benchzstd.c:89:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
zstd-1.5.6/programs/benchzstd.c:94:9: note: in expansion of macro ‘OUTPUT’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
zstd-1.5.6/programs/benchzstd.c:94:9: note: in expansion of macro ‘OUTPUT’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
zstd-1.5.6/programs/benchzstd.c:94:9: note: in expansion of macro ‘OUTPUT’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
zstd-1.5.6/programs/benchzstd.c:89:9: note: read of 8 bytes from after the end of ‘dictFileName’
zstd-1.5.6/programs/benchzstd.c:94:9: note: in expansion of macro ‘OUTPUT’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
#                                         └──────────────────────────────────────┘
#                                                            ^
#   87|   #define OUTPUT(...)                   \
#   88|       {                                 \
#   89|->         fprintf(stdout, __VA_ARGS__); \
#   90|           fflush(NULL);                 \
#   91|       }

Error: GCC_ANALYZER_WARNING (CWE-126): [#def31]
zstd-1.5.6/programs/benchzstd.c: scope_hint: In function ‘BMK_loadFiles’
zstd-1.5.6/programs/benchzstd.c:1061:24: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
zstd-1.5.6/programs/benchzstd.c:1061:24: note: read of 8 bytes from after the end of ‘dictFileName’
#                                         └──────────────────────────────────────┘
#                                                            ^
# 1059|       unsigned n;
# 1060|       for (n = 0; n < nbFiles; n++) {
# 1061|->         U64 fileSize = UTIL_getFileSize(
# 1062|                   fileNamesTable[n]); /* last file may be shortened */
# 1063|           if (UTIL_isDirectory(fileNamesTable[n])) {

Error: GCC_ANALYZER_WARNING (CWE-126): [#def32]
zstd-1.5.6/programs/benchzstd.c:1063:13: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
zstd-1.5.6/programs/benchzstd.c:1063:13: note: read of 8 bytes from after the end of ‘dictFileName’
#                                         └──────────────────────────────────────┘
#                                                            ^
# 1061|           U64 fileSize = UTIL_getFileSize(
# 1062|                   fileNamesTable[n]); /* last file may be shortened */
# 1063|->         if (UTIL_isDirectory(fileNamesTable[n])) {
# 1064|               DISPLAYLEVEL(
# 1065|                       2, "Ignoring %s directory...       \n", fileNamesTable[n]);

Error: GCC_ANALYZER_WARNING (CWE-126): [#def33]
zstd-1.5.6/programs/benchzstd.c:1078:29: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
zstd-1.5.6/programs/benchzstd.c:1078:29: note: read of 8 bytes from after the end of ‘dictFileName’
#                                         └──────────────────────────────────────┘
#                                                            ^
# 1076|           }
# 1077|           {
# 1078|->             FILE* const f = fopen(fileNamesTable[n], "rb");
# 1079|               if (f == NULL)
# 1080|                   RETURN_ERROR_INT(

Error: GCC_ANALYZER_WARNING (CWE-775): [#def34]
zstd-1.5.6/programs/benchzstd.c:1083:39: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*<unknown>, "rb")’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
# 1081|                           10, "impossible to open file %s", fileNamesTable[n]);
# 1082|               OUTPUTLEVEL(2, "Loading %s...       \r", fileNamesTable[n]);
# 1083|->             if (fileSize > bufferSize - pos)
# 1084|                   fileSize = bufferSize - pos,
# 1085|                   nbFiles  = n; /* buffer too small - stop after this file */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def35]
zstd-1.5.6/programs/benchzstd.c:1083:39: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*<unknown>, "rb")’
zstd-1.5.6/programs/benchzstd.c:1082:13: note: in expansion of macro ‘OUTPUTLEVEL’
# 1081|                           10, "impossible to open file %s", fileNamesTable[n]);
# 1082|               OUTPUTLEVEL(2, "Loading %s...       \r", fileNamesTable[n]);
# 1083|->             if (fileSize > bufferSize - pos)
# 1084|                   fileSize = bufferSize - pos,
# 1085|                   nbFiles  = n; /* buffer too small - stop after this file */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def36]
zstd-1.5.6/programs/dibio.c: scope_hint: In function ‘DiB_loadFiles’
zstd-1.5.6/programs/dibio.c:90:26: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*<unknown>, "rb")’
zstd-1.5.6/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’
zstd-1.5.6/programs/dibio.c:140:9: note: in expansion of macro ‘DISPLAYUPDATE’
zstd-1.5.6/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’
zstd-1.5.6/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’
#   88|   **********************************************************/
#   89|   #undef MIN
#   90|-> #define MIN(a,b)    ((a) < (b) ? (a) : (b))
#   91|   
#   92|   /**

Error: GCC_ANALYZER_WARNING (CWE-401): [#def37]
zstd-1.5.6/programs/dibio.c:90:26: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*<unknown>, "rb")’
zstd-1.5.6/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’
zstd-1.5.6/programs/dibio.c:140:9: note: in expansion of macro ‘DISPLAYUPDATE’
zstd-1.5.6/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’
zstd-1.5.6/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’
#   88|   **********************************************************/
#   89|   #undef MIN
#   90|-> #define MIN(a,b)    ((a) < (b) ? (a) : (b))
#   91|   
#   92|   /**

Error: GCC_ANALYZER_WARNING (CWE-775): [#def38]
zstd-1.5.6/programs/dibio.c:146:29: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*<unknown>, "rb")’
zstd-1.5.6/programs/dibio.c:140:9: note: in expansion of macro ‘DISPLAYUPDATE’
#  144|                               (size_t)MIN(fileSize, (S64)targetChunkSize) :
#  145|                               (size_t)MIN(fileSize, SAMPLESIZE_MAX );
#  146|->         if (totalDataLoaded + fileDataLoaded > *bufferSizePtr)
#  147|               break;
#  148|           if (fread( buff+totalDataLoaded, 1, fileDataLoaded, f ) != fileDataLoaded)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def39]
zstd-1.5.6/programs/dibio.c:146:29: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*<unknown>, "rb")’
zstd-1.5.6/programs/dibio.c:140:9: note: in expansion of macro ‘DISPLAYUPDATE’
#  144|                               (size_t)MIN(fileSize, (S64)targetChunkSize) :
#  145|                               (size_t)MIN(fileSize, SAMPLESIZE_MAX );
#  146|->         if (totalDataLoaded + fileDataLoaded > *bufferSizePtr)
#  147|               break;
#  148|           if (fread( buff+totalDataLoaded, 1, fileDataLoaded, f ) != fileDataLoaded)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def40]
zstd-1.5.6/programs/dibio.c: scope_hint: In function ‘DiB_saveDict’
zstd-1.5.6/programs/dibio.c:254:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(dictFileName, "wb")’
#  252|   
#  253|       { size_t const n = fwrite(buff, 1, buffSize, f);
#  254|->       if (n!=buffSize) EXM_THROW(4, "%s : write error", dictFileName) }
#  255|   
#  256|       { size_t const n = (size_t)fclose(f);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def41]
zstd-1.5.6/programs/dibio.c:254:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(dictFileName, "wb")’
#  252|   
#  253|       { size_t const n = fwrite(buff, 1, buffSize, f);
#  254|->       if (n!=buffSize) EXM_THROW(4, "%s : write error", dictFileName) }
#  255|   
#  256|       { size_t const n = (size_t)fclose(f);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def42]
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c:724:64: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c:46: included_from: Included from here.
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:33: included_from: Included from here.
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  722|       fileSize = UTIL_getFileSizeStat(dictFileStat);
#  723|       {
#  724|->         size_t const dictSizeMax = prefs->patchFromMode ? prefs->memLimit : DICTSIZE_MAX;
#  725|           if (fileSize >  dictSizeMax) {
#  726|               EXM_THROW(34, "Dictionary file %s is too large (> %u bytes)",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def43]
zstd-1.5.6/programs/fileio.c:724:64: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  722|       fileSize = UTIL_getFileSizeStat(dictFileStat);
#  723|       {
#  724|->         size_t const dictSizeMax = prefs->patchFromMode ? prefs->memLimit : DICTSIZE_MAX;
#  725|           if (fileSize >  dictSizeMax) {
#  726|               EXM_THROW(34, "Dictionary file %s is too large (> %u bytes)",

Error: GCC_ANALYZER_WARNING (CWE-775): [#def44]
zstd-1.5.6/programs/fileio.c:725:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  723|       {
#  724|           size_t const dictSizeMax = prefs->patchFromMode ? prefs->memLimit : DICTSIZE_MAX;
#  725|->         if (fileSize >  dictSizeMax) {
#  726|               EXM_THROW(34, "Dictionary file %s is too large (> %u bytes)",
#  727|                               fileName,  (unsigned)dictSizeMax);   /* avoid extreme cases */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def45]
zstd-1.5.6/programs/fileio.c:725:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  723|       {
#  724|           size_t const dictSizeMax = prefs->patchFromMode ? prefs->memLimit : DICTSIZE_MAX;
#  725|->         if (fileSize >  dictSizeMax) {
#  726|               EXM_THROW(34, "Dictionary file %s is too large (> %u bytes)",
#  727|                               fileName,  (unsigned)dictSizeMax);   /* avoid extreme cases */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def46]
zstd-1.5.6/programs/fileio.c:731:8: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  729|       }
#  730|       *bufferPtr = malloc((size_t)fileSize);
#  731|->     if (*bufferPtr==NULL) EXM_THROW(34, "%s", strerror(errno));
#  732|       {   size_t const readSize = fread(*bufferPtr, 1, (size_t)fileSize, fileHandle);
#  733|           if (readSize != fileSize) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def47]
zstd-1.5.6/programs/fileio.c:731:8: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  729|       }
#  730|       *bufferPtr = malloc((size_t)fileSize);
#  731|->     if (*bufferPtr==NULL) EXM_THROW(34, "%s", strerror(errno));
#  732|       {   size_t const readSize = fread(*bufferPtr, 1, (size_t)fileSize, fileHandle);
#  733|           if (readSize != fileSize) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def48]
zstd-1.5.6/programs/fileio.c:733:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  731|       if (*bufferPtr==NULL) EXM_THROW(34, "%s", strerror(errno));
#  732|       {   size_t const readSize = fread(*bufferPtr, 1, (size_t)fileSize, fileHandle);
#  733|->         if (readSize != fileSize) {
#  734|               EXM_THROW(35, "Error reading dictionary file %s : %s",
#  735|                       fileName, strerror(errno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def49]
zstd-1.5.6/programs/fileio.c:733:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:714:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  731|       if (*bufferPtr==NULL) EXM_THROW(34, "%s", strerror(errno));
#  732|       {   size_t const readSize = fread(*bufferPtr, 1, (size_t)fileSize, fileHandle);
#  733|->         if (readSize != fileSize) {
#  734|               EXM_THROW(35, "Error reading dictionary file %s : %s",
#  735|                       fileName, strerror(errno));

Error: GCC_ANALYZER_WARNING (CWE-775): [#def50]
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’
zstd-1.5.6/programs/fileio.c:771:64: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(fileName, 0)’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:761:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  769|       fileSize = UTIL_getFileSizeStat(dictFileStat);
#  770|       {
#  771|->         size_t const dictSizeMax = prefs->patchFromMode ? prefs->memLimit : DICTSIZE_MAX;
#  772|           if (fileSize >  dictSizeMax) {
#  773|               EXM_THROW(34, "Dictionary file %s is too large (> %u bytes)",

Error: GCC_ANALYZER_WARNING (CWE-775): [#def51]
zstd-1.5.6/programs/fileio.c:772:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(fileName, 0)’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’
zstd-1.5.6/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2344:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’
zstd-1.5.6/programs/fileio.c:2345:5: note: in expansion of macro ‘CHECK’
zstd-1.5.6/programs/fileio.c:761:5: note: in expansion of macro ‘DISPLAYLEVEL’
#  770|       {
#  771|           size_t const dictSizeMax = prefs->patchFromMode ? prefs->memLimit : DICTSIZE_MAX;
#  772|->         if (fileSize >  dictSizeMax) {
#  773|               EXM_THROW(34, "Dictionary file %s is too large (> %u bytes)",
#  774|                               fileName,  (unsigned)dictSizeMax);   /* avoid extreme cases */

Error: GCC_ANALYZER_WARNING (CWE-415): [#def52]
zstd-1.5.6/programs/util.c: scope_hint: In function ‘UTIL_realloc’
zstd-1.5.6/programs/util.c:108:5: warning[-Wanalyzer-double-free]: double-‘free’ of ‘ptr’
zstd-1.5.6/programs/util.c: scope_hint: In function ‘UTIL_realloc’
zstd-1.5.6/programs/util.c: scope_hint: In function ‘UTIL_realloc’
zstd-1.5.6/programs/util.c: scope_hint: In function ‘UTIL_realloc’
zstd-1.5.6/programs/util.c: scope_hint: In function ‘UTIL_realloc’
zstd-1.5.6/programs/util.c: scope_hint: In function ‘UTIL_realloc’
zstd-1.5.6/programs/util.c: scope_hint: In function ‘UTIL_realloc’
zstd-1.5.6/programs/util.c:24: included_from: Included from here.
#  106|       void *newptr = realloc(ptr, size);
#  107|       if (newptr) return newptr;
#  108|->     free(ptr);
#  109|       return NULL;
#  110|   }

Scan Properties

analyzer-version-clang18.1.3
analyzer-version-cppcheck2.13.0
analyzer-version-gcc14.0.1
analyzer-version-gcc-analyzer14.0.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-63.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namezstd-1.5.6-1.fc41
store-results-to/tmp/tmp7oql940n/zstd-1.5.6-1.fc41.tar.xz
time-created2024-04-22 11:28:00
time-finished2024-04-22 11:34:02
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp7oql940n/zstd-1.5.6-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp7oql940n/zstd-1.5.6-1.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9