]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix static analyzer warnings 2677/head
authorSen Huang <senhuang96@fb.com>
Thu, 29 Jul 2021 16:05:51 +0000 (09:05 -0700)
committerSen Huang <senhuang96@fb.com>
Thu, 29 Jul 2021 16:11:12 +0000 (09:11 -0700)
lib/compress/zstd_compress.c
lib/compress/zstd_lazy.c

index d6bbca7d100b5db19627f4685f07f6470b8cfbeb..fa49df6ab42d759fe069b5f99f82cb9da477c736 100644 (file)
@@ -3646,6 +3646,7 @@ static size_t ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc, void* dst, s
     repcodes_t cRep;
     ZSTD_memcpy(dRep.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t));
     ZSTD_memcpy(cRep.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t));
+    ZSTD_memset(&nextSeqStore, 0, sizeof(seqStore_t));
 
     DEBUGLOG(4, "ZSTD_compressBlock_splitBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)",
                 (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit,
index 4dfd9d9ed3f0b4cdef91234fdba7e3ccf9f30ca5..957c88be901b69b64bb4a2adf4b11d3c3cc6492d 100644 (file)
@@ -1176,9 +1176,10 @@ size_t ZSTD_RowFindBestMatch_generic (
 
     /* DMS/DDS variables that may be referenced laster */
     const ZSTD_matchState_t* const dms = ms->dictMatchState;
-    size_t ddsIdx;
-    U32 ddsExtraAttempts; /* cctx hash tables are limited in searches, but allow extra searches into DDS */
-    U32 dmsTag;
+    /* Initialize the following variables to satisfy static analyzer */
+    size_t ddsIdx = 0;
+    U32 ddsExtraAttempts = 0; /* cctx hash tables are limited in searches, but allow extra searches into DDS */
+    U32 dmsTag = 0;
     U32* dmsRow = NULL;
     BYTE* dmsTagRow = NULL;