Switch ALLOC() to ALLOC_AND_ZERO() to Paper Over Existing Uninitialized Read
authorW. Felix Handte <w@felixhandte.com>
Tue, 13 Mar 2018 21:47:34 +0000 (17:47 -0400)
committerW. Felix Handte <w@felixhandte.com>
Tue, 13 Mar 2018 21:47:34 +0000 (17:47 -0400)
lib/lz4frame.c

index 87e209f..b91cb7c 100644 (file)
@@ -605,7 +605,7 @@ size_t LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctxPtr,
         if (cctxPtr->maxBufferSize < requiredBuffSize) {
             cctxPtr->maxBufferSize = 0;
             FREEMEM(cctxPtr->tmpBuff);
-            cctxPtr->tmpBuff = (BYTE*)ALLOC(requiredBuffSize);
+            cctxPtr->tmpBuff = (BYTE*)ALLOC_AND_ZERO(requiredBuffSize);
             if (cctxPtr->tmpBuff == NULL) return err0r(LZ4F_ERROR_allocation_failed);
             cctxPtr->maxBufferSize = requiredBuffSize;
     }   }