Task #224 - zstd-1.5.5-5.fc40/scan-results.err
back to task #224download
Error: CLANG_WARNING: zstd-1.5.5/lib/compress/zstd_compress_sequences.c:14: included_from: Included from here. zstd-1.5.5/lib/compress/zstd_compress_sequences.h:15: included_from: Included from here. zstd-1.5.5/lib/common/zstd_internal.h:30: included_from: Included from here. zstd-1.5.5/lib/common/fse.h:236: included_from: Included from here. zstd-1.5.5/lib/common/bitstream.h:171:25: warning[core.UndefinedBinaryOperatorResult]: The right operand of '&' is a garbage value due to array index out of bounds # 169| #else # 170| assert(nbBits < BIT_MASK_SIZE); # 171|-> return bitContainer & BIT_mask[nbBits]; # 172| #endif # 173| } Error: CLANG_WARNING: zstd-1.5.5/programs/benchzstd.c:42: included_from: Included from here. zstd-1.5.5/lib/common/xxhash.h:1457:76: warning[unix.cstring.NullArg]: Null pointer passed as 2nd argument to memory copy function # 1455| static void* XXH_malloc(size_t s) { return ZSTD_malloc(s); } # 1456| static void XXH_free (void* p) { ZSTD_free(p); } # 1457|-> static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_memcpy(dest,src,size); } # 1458| # 1459| Error: CLANG_WARNING: zstd-1.5.5/programs/benchzstd.c:42: included_from: Included from here. zstd-1.5.5/lib/common/xxhash.h:2450:16: warning[core.NullDereference]: Dereference of null pointer # 2448| } # 2449| while (len > 0) { # 2450|-> h64 ^= (*ptr++) * XXH_PRIME64_5; # 2451| h64 = XXH_rotl64(h64, 11) * XXH_PRIME64_1; # 2452| --len; Error: CPPCHECK_WARNING (CWE-457): zstd-1.5.5/lib/compress/zstd_compress.c:2752: error[uninitvar]: Uninitialized variables: stats.Offtype, stats.MLtype # 2750| DEBUGLOG(3, "ZSTD_buildCTable for LitLens failed"); # 2751| stats.size = countSize; # 2752|-> return stats; # 2753| } # 2754| if (stats.LLtype == set_compressed) Error: GCC_ANALYZER_WARNING (CWE-457): zstd-1.5.5/lib/compress/zstd_compress.c: scope_hint: In function ‘ZSTD_buildSequencesStatistics’ zstd-1.5.5/lib/compress/zstd_compress.c:2752:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘stats.Offtype’ zstd-1.5.5/lib/common/bitstream.h:32: included_from: Included from here. zstd-1.5.5/lib/common/fse.h:236: included_from: Included from here. zstd-1.5.5/lib/compress/zstd_compress.c:19: included_from: Included from here. zstd-1.5.5/lib/compress/zstd_compress.c:4582:5: note: in expansion of macro ‘RETURN_ERROR_IF’ zstd-1.5.5/lib/compress/zstd_compress.c: scope_hint: In function ‘ZSTD_buildSequencesStatistics’ zstd-1.5.5/lib/compress/zstd_compress.c:3194:13: note: in expansion of macro ‘RETURN_ERROR_IF’ zstd-1.5.5/lib/compress/zstd_compress.c:4238:9: note: in expansion of macro ‘FORWARD_IF_ERROR’ zstd-1.5.5/lib/compress/zstd_compress.c:2879:9: note: in expansion of macro ‘FORWARD_IF_ERROR’ zstd-1.5.5/lib/compress/zstd_compress.c:2885:5: note: in expansion of macro ‘RETURN_ERROR_IF’ # 2750| DEBUGLOG(3, "ZSTD_buildCTable for LitLens failed"); # 2751| stats.size = countSize; # 2752|-> return stats; # 2753| } # 2754| if (stats.LLtype == set_compressed) Error: GCC_ANALYZER_WARNING (CWE-457): zstd-1.5.5/lib/compress/zstd_compress.c:2784:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘stats.MLtype’ zstd-1.5.5/lib/compress/zstd_compress.c:4582:5: note: in expansion of macro ‘RETURN_ERROR_IF’ zstd-1.5.5/lib/compress/zstd_compress.c: scope_hint: In function ‘ZSTD_buildSequencesStatistics’ zstd-1.5.5/lib/compress/zstd_compress.c:3194:13: note: in expansion of macro ‘RETURN_ERROR_IF’ zstd-1.5.5/lib/compress/zstd_compress.c:4238:9: note: in expansion of macro ‘FORWARD_IF_ERROR’ zstd-1.5.5/lib/compress/zstd_compress.c:2879:9: note: in expansion of macro ‘FORWARD_IF_ERROR’ zstd-1.5.5/lib/compress/zstd_compress.c:2885:5: note: in expansion of macro ‘RETURN_ERROR_IF’ # 2782| DEBUGLOG(3, "ZSTD_buildCTable for Offsets failed"); # 2783| stats.size = countSize; # 2784|-> return stats; # 2785| } # 2786| if (stats.Offtype == set_compressed) Error: CLANG_WARNING: zstd-1.5.5/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: GCC_ANALYZER_WARNING (CWE-401): zstd-1.5.5/lib/compress/zstdmt_compress.c: scope_hint: In function ‘ZSTDMT_getBuffer’ zstd-1.5.5/lib/compress/zstdmt_compress.c:216:16: warning[-Wanalyzer-malloc-leak]: leak of ‘<return-value>.start’ zstd-1.5.5/lib/compress/zstd_compress_internal.h:21: included_from: Included from here. zstd-1.5.5/lib/compress/zstdmt_compress.c:28: included_from: Included from here. zstd-1.5.5/lib/common/zstd_internal.h:58:24: note: in definition of macro ‘MIN’ zstd-1.5.5/lib/compress/zstdmt_compress.c:23: included_from: Included from here. zstd-1.5.5/lib/common/allocations.h:15: included_from: Included from here. zstd-1.5.5/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’ zstd-1.5.5/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’ # 214| DEBUGLOG(5, "ZSTDMT_getBuffer: created buffer of size %u", (U32)bSize); # 215| } # 216|-> return buffer; # 217| } # 218| } Error: GCC_ANALYZER_WARNING (CWE-401): zstd-1.5.5/lib/compress/zstdmt_compress.c:216:16: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ zstd-1.5.5/lib/common/zstd_internal.h:26: included_from: Included from here. zstd-1.5.5/lib/common/error_private.h:144:30: note: in definition of macro ‘FORWARD_IF_ERROR’ zstd-1.5.5/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’ zstd-1.5.5/lib/common/allocations.h:30:12: note: in expansion of macro ‘ZSTD_malloc’ # 214| DEBUGLOG(5, "ZSTDMT_getBuffer: created buffer of size %u", (U32)bSize); # 215| } # 216|-> return buffer; # 217| } # 218| } Error: CLANG_WARNING: zstd-1.5.5/lib/compress/zstdmt_compress.c:251:5: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 249| DEBUGLOG(5, "ZSTDMT_releaseBuffer"); # 250| if (buf.start == NULL) return; /* compatible with release on NULL */ # 251|-> ZSTD_pthread_mutex_lock(&bufPool->poolMutex); # 252| if (bufPool->nbBuffers < bufPool->totalBuffers) { # 253| bufPool->bTable[bufPool->nbBuffers++] = buf; /* stored for later use */ Error: CLANG_WARNING: zstd-1.5.5/lib/compress/zstdmt_compress.c:982:44: warning[core.NullDereference]: Dereference of null pointer # 980| for (jobID=0; jobID <= mtctx->jobIDMask; jobID++) { # 981| /* Copy the mutex/cond out */ # 982|-> ZSTD_pthread_mutex_t const mutex = mtctx->jobs[jobID].job_mutex; # 983| ZSTD_pthread_cond_t const cond = mtctx->jobs[jobID].job_cond; # 984| Error: GCC_ANALYZER_WARNING (CWE-835): zstd-1.5.5/lib/compress/zstdmt_compress.c: scope_hint: In function ‘ZSTDMT_waitForAllJobsCompleted’ zstd-1.5.5/lib/compress/zstdmt_compress.c:1004:27: warning[-Wanalyzer-infinite-loop]: infinite loop # 1002| unsigned const jobID = mtctx->doneJobID & mtctx->jobIDMask; # 1003| ZSTD_PTHREAD_MUTEX_LOCK(&mtctx->jobs[jobID].job_mutex); # 1004|-> while (mtctx->jobs[jobID].consumed < mtctx->jobs[jobID].src.size) { # 1005| DEBUGLOG(4, "waiting for jobCompleted signal from job %u", mtctx->doneJobID); /* we want to block when waiting for data to flush */ # 1006| ZSTD_pthread_cond_wait(&mtctx->jobs[jobID].job_cond, &mtctx->jobs[jobID].job_mutex); Error: GCC_ANALYZER_WARNING (CWE-835): zstd-1.5.5/lib/compress/zstdmt_compress.c: scope_hint: In function ‘ZSTDMT_flushProduced’ zstd-1.5.5/lib/compress/zstdmt_compress.c:1448:27: warning[-Wanalyzer-infinite-loop]: infinite loop # 1446| && (mtctx->doneJobID < mtctx->nextJobID) ) { # 1447| assert(mtctx->jobs[wJobID].dstFlushed <= mtctx->jobs[wJobID].cSize); # 1448|-> while (mtctx->jobs[wJobID].dstFlushed == mtctx->jobs[wJobID].cSize) { /* nothing to flush */ # 1449| if (mtctx->jobs[wJobID].consumed == mtctx->jobs[wJobID].src.size) { # 1450| DEBUGLOG(5, "job %u is completely consumed (%u == %u) => don't wait for cond, there will be none", Error: CPPCHECK_WARNING (CWE-457): zstd-1.5.5/lib/decompress/zstd_decompress.c:726: error[uninitvar]: Uninitialized variable: frameSizeInfo.nbBlocks # 724| frameSizeInfo.compressedSize = ret; # 725| frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR; # 726|-> return frameSizeInfo; # 727| } # 728| Error: GCC_ANALYZER_WARNING (CWE-835): zstd-1.5.5/lib/dictBuilder/cover.c: scope_hint: In function ‘COVER_best_wait.part.0’ zstd-1.5.5/lib/dictBuilder/cover.c:871:14: warning[-Wanalyzer-infinite-loop]: infinite loop # 869| } # 870| ZSTD_pthread_mutex_lock(&best->mutex); # 871|-> while (best->liveJobs != 0) { # 872| ZSTD_pthread_cond_wait(&best->cond, &best->mutex); # 873| } Error: GCC_ANALYZER_WARNING (CWE-457): zstd-1.5.5/lib/dictBuilder/cover.c: scope_hint: In function ‘COVER_selectDict’ zstd-1.5.5/lib/dictBuilder/cover.c:994:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘customDictContent’ zstd-1.5.5/lib/dictBuilder/cover.c:72:30: note: in expansion of macro ‘LOCALDISPLAYLEVEL’ zstd-1.5.5/lib/dictBuilder/cover.c:732:3: note: in expansion of macro ‘DISPLAYLEVEL’ # 992| # 993| /* Initial dictionary size and compressed size */ # 994|-> memcpy(largestDictbuffer, customDictContent, dictContentSize); # 995| dictContentSize = ZDICT_finalizeDictionary( # 996| largestDictbuffer, dictBufferCapacity, customDictContent, dictContentSize, Error: CLANG_WARNING: zstd-1.5.5/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: zstd-1.5.5/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: zstd-1.5.5/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: zstd-1.5.5/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: zstd-1.5.5/lib/legacy/zstd_v06.c:490:57: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 488| * Shared functions to include for inlining # 489| *********************************************/ # 490|-> static void ZSTDv06_copy8(void* dst, const void* src) { memcpy(dst, src, 8); } # 491| #define COPY8(d,s) { ZSTDv06_copy8(d,s); d+=8; s+=8; } # 492| Error: CLANG_WARNING: zstd-1.5.5/lib/legacy/zstd_v06.c:3347:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 3345| match = dictEnd - (base-match); # 3346| if (match + sequence.matchLength <= dictEnd) { # 3347|-> memmove(oLitEnd, match, sequence.matchLength); # 3348| return sequenceLength; # 3349| } Error: CLANG_WARNING: zstd-1.5.5/lib/legacy/zstd_v06.c:3352:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 3350| /* span extDict & currentPrefixSegment */ # 3351| { size_t const length1 = dictEnd - match; # 3352|-> memmove(oLitEnd, match, length1); # 3353| op = oLitEnd + length1; # 3354| sequence.matchLength -= length1; Error: CLANG_WARNING: zstd-1.5.5/lib/legacy/zstd_v06.c:3369:17: warning[core.NullDereference]: Array access (from variable 'match') results in a null pointer dereference # 3367| static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 }; /* subtracted */ # 3368| int const sub2 = dec64table[sequence.offset]; # 3369|-> op[0] = match[0]; # 3370| op[1] = match[1]; # 3371| op[2] = match[2]; Error: CLANG_WARNING: zstd-1.5.5/lib/legacy/zstd_v06.c:3463:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 3461| if (op+lastLLSize > oend) return ERROR(dstSize_tooSmall); # 3462| if (lastLLSize > 0) { # 3463|-> memcpy(op, litPtr, lastLLSize); # 3464| op += lastLLSize; # 3465| } Error: CPPCHECK_WARNING (CWE-457): zstd-1.5.5/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): zstd-1.5.5/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.5/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): zstd-1.5.5/programs/benchzstd.c:75:32: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read zstd-1.5.5/programs/benchzstd.c:76:53: note: in expansion of macro ‘DISPLAY’ zstd-1.5.5/programs/benchzstd.c:771:13: note: in expansion of macro ‘DISPLAYLEVEL’ zstd-1.5.5/programs/benchzstd.c:771:13: note: in expansion of macro ‘DISPLAYLEVEL’ zstd-1.5.5/programs/benchzstd.c:771:13: note: in expansion of macro ‘DISPLAYLEVEL’ zstd-1.5.5/programs/benchzstd.c:76:53: note: in expansion of macro ‘DISPLAY’ zstd-1.5.5/programs/benchzstd.c:771:13: note: in expansion of macro ‘DISPLAYLEVEL’ zstd-1.5.5/programs/benchzstd.c:76:53: note: in expansion of macro ‘DISPLAY’ zstd-1.5.5/programs/benchzstd.c:771:13: note: in expansion of macro ‘DISPLAYLEVEL’ zstd-1.5.5/programs/benchzstd.c:75:32: note: read of 8 bytes from after the end of ‘dictFileName’ zstd-1.5.5/programs/benchzstd.c:76:53: note: in expansion of macro ‘DISPLAY’ zstd-1.5.5/programs/benchzstd.c:771:13: note: in expansion of macro ‘DISPLAYLEVEL’ # └──────────────────────────────────────┘ # ^ # 73| * console display # 74| ***************************************/ # 75|-> #define DISPLAY(...) { fprintf(stderr, __VA_ARGS__); fflush(NULL); } # 76| #define DISPLAYLEVEL(l, ...) if (displayLevel>=l) { DISPLAY(__VA_ARGS__); } # 77| /* 0 : no display; 1: errors; 2 : + result + interaction + warnings; 3 : + progression; 4 : + information */ Error: GCC_ANALYZER_WARNING (CWE-126): zstd-1.5.5/programs/benchzstd.c:78:32: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read zstd-1.5.5/programs/benchzstd.c:79:53: note: in expansion of macro ‘OUTPUT’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ zstd-1.5.5/programs/benchzstd.c:79:53: note: in expansion of macro ‘OUTPUT’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ zstd-1.5.5/programs/benchzstd.c:79:53: note: in expansion of macro ‘OUTPUT’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ zstd-1.5.5/programs/benchzstd.c:78:32: note: read of 8 bytes from after the end of ‘dictFileName’ zstd-1.5.5/programs/benchzstd.c:79:53: note: in expansion of macro ‘OUTPUT’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ # └──────────────────────────────────────┘ # ^ # 76| #define DISPLAYLEVEL(l, ...) if (displayLevel>=l) { DISPLAY(__VA_ARGS__); } # 77| /* 0 : no display; 1: errors; 2 : + result + interaction + warnings; 3 : + progression; 4 : + information */ # 78|-> #define OUTPUT(...) { fprintf(stdout, __VA_ARGS__); fflush(NULL); } # 79| #define OUTPUTLEVEL(l, ...) if (displayLevel>=l) { OUTPUT(__VA_ARGS__); } # 80| Error: GCC_ANALYZER_WARNING (CWE-126): zstd-1.5.5/programs/benchzstd.c: scope_hint: In function ‘BMK_loadFiles’ zstd-1.5.5/programs/benchzstd.c:769:24: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read zstd-1.5.5/programs/benchzstd.c:769:24: note: read of 8 bytes from after the end of ‘dictFileName’ # └──────────────────────────────────────┘ # ^ # 767| unsigned n; # 768| for (n=0; n<nbFiles; n++) { # 769|-> U64 fileSize = UTIL_getFileSize(fileNamesTable[n]); /* last file may be shortened */ # 770| if (UTIL_isDirectory(fileNamesTable[n])) { # 771| DISPLAYLEVEL(2, "Ignoring %s directory... \n", fileNamesTable[n]); Error: GCC_ANALYZER_WARNING (CWE-126): zstd-1.5.5/programs/benchzstd.c:770:13: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read zstd-1.5.5/programs/benchzstd.c:770:13: note: read of 8 bytes from after the end of ‘dictFileName’ # └──────────────────────────────────────┘ # ^ # 768| for (n=0; n<nbFiles; n++) { # 769| U64 fileSize = UTIL_getFileSize(fileNamesTable[n]); /* last file may be shortened */ # 770|-> if (UTIL_isDirectory(fileNamesTable[n])) { # 771| DISPLAYLEVEL(2, "Ignoring %s directory... \n", fileNamesTable[n]); # 772| fileSizes[n] = 0; Error: GCC_ANALYZER_WARNING (CWE-126): zstd-1.5.5/programs/benchzstd.c:780:29: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read zstd-1.5.5/programs/benchzstd.c:780:29: note: read of 8 bytes from after the end of ‘dictFileName’ # └──────────────────────────────────────┘ # ^ # 778| continue; # 779| } # 780|-> { FILE* const f = fopen(fileNamesTable[n], "rb"); # 781| if (f==NULL) RETURN_ERROR_INT(10, "impossible to open file %s", fileNamesTable[n]); # 782| OUTPUTLEVEL(2, "Loading %s... \r", fileNamesTable[n]); Error: GCC_ANALYZER_WARNING (CWE-775): zstd-1.5.5/programs/benchzstd.c:783:38: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*<unknown>, "rb")’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ # 781| if (f==NULL) RETURN_ERROR_INT(10, "impossible to open file %s", fileNamesTable[n]); # 782| OUTPUTLEVEL(2, "Loading %s... \r", fileNamesTable[n]); # 783|-> if (fileSize > bufferSize-pos) fileSize = bufferSize-pos, nbFiles=n; /* buffer too small - stop after this file */ # 784| { size_t const readSize = fread(((char*)buffer)+pos, 1, (size_t)fileSize, f); # 785| if (readSize != (size_t)fileSize) RETURN_ERROR_INT(11, "could not read %s", fileNamesTable[n]); Error: GCC_ANALYZER_WARNING (CWE-401): zstd-1.5.5/programs/benchzstd.c:783:38: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*<unknown>, "rb")’ zstd-1.5.5/programs/benchzstd.c:782:13: note: in expansion of macro ‘OUTPUTLEVEL’ # 781| if (f==NULL) RETURN_ERROR_INT(10, "impossible to open file %s", fileNamesTable[n]); # 782| OUTPUTLEVEL(2, "Loading %s... \r", fileNamesTable[n]); # 783|-> if (fileSize > bufferSize-pos) fileSize = bufferSize-pos, nbFiles=n; /* buffer too small - stop after this file */ # 784| { size_t const readSize = fread(((char*)buffer)+pos, 1, (size_t)fileSize, f); # 785| if (readSize != (size_t)fileSize) RETURN_ERROR_INT(11, "could not read %s", fileNamesTable[n]); Error: GCC_ANALYZER_WARNING (CWE-775): zstd-1.5.5/programs/dibio.c: scope_hint: In function ‘DiB_loadFiles’ zstd-1.5.5/programs/dibio.c:90:26: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*<unknown>, "rb")’ zstd-1.5.5/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’ zstd-1.5.5/programs/dibio.c:140:9: note: in expansion of macro ‘DISPLAYUPDATE’ zstd-1.5.5/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’ zstd-1.5.5/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): zstd-1.5.5/programs/dibio.c:90:26: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*<unknown>, "rb")’ zstd-1.5.5/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’ zstd-1.5.5/programs/dibio.c:140:9: note: in expansion of macro ‘DISPLAYUPDATE’ zstd-1.5.5/programs/dibio.c:144:37: note: in expansion of macro ‘MIN’ zstd-1.5.5/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): zstd-1.5.5/programs/dibio.c:146:29: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*<unknown>, "rb")’ zstd-1.5.5/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): zstd-1.5.5/programs/dibio.c:146:29: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*<unknown>, "rb")’ zstd-1.5.5/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): zstd-1.5.5/programs/dibio.c: scope_hint: In function ‘DiB_saveDict’ zstd-1.5.5/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): zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c:724:64: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c:46: included_from: Included from here. zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio.c:33: included_from: Included from here. zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:724:64: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:725:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:725:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:731:8: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:731:8: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:733:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:733:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fileName, "rb")’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMalloc’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’ zstd-1.5.5/programs/fileio.c:771:64: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(fileName, 0)’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/fileio.c:772:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(fileName, 0)’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’ zstd-1.5.5/programs/fileio.c: scope_hint: In function ‘FIO_setDictBufferMMap’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2239:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:74:9: note: in definition of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/programs/fileio_common.h:79:32: note: in expansion of macro ‘CHECK_V’ zstd-1.5.5/programs/fileio.c:2240:5: note: in expansion of macro ‘CHECK’ zstd-1.5.5/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): zstd-1.5.5/programs/util.c: scope_hint: In function ‘UTIL_realloc’ zstd-1.5.5/programs/util.c:97:5: warning[-Wanalyzer-double-free]: double-‘free’ of ‘ptr’ zstd-1.5.5/programs/util.c: scope_hint: In function ‘UTIL_realloc’ zstd-1.5.5/programs/util.c: scope_hint: In function ‘UTIL_realloc’ zstd-1.5.5/programs/util.c: scope_hint: In function ‘UTIL_realloc’ zstd-1.5.5/programs/util.c: scope_hint: In function ‘UTIL_realloc’ zstd-1.5.5/programs/util.c: scope_hint: In function ‘UTIL_realloc’ zstd-1.5.5/programs/util.c: scope_hint: In function ‘UTIL_realloc’ zstd-1.5.5/programs/util.c:24: included_from: Included from here. # 95| void *newptr = realloc(ptr, size); # 96| if (newptr) return newptr; # 97|-> free(ptr); # 98| return NULL; # 99| }