]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed minor asan warning in legacy decoder
authorYann Collet <yann.collet.73@gmail.com>
Wed, 11 May 2016 09:07:54 +0000 (11:07 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Wed, 11 May 2016 09:07:54 +0000 (11:07 +0200)
lib/legacy/zstd_v05.c

index 6425ad2cc8ecb751d38160c81de5d15c130f8e86..42e925c4280bbb0880697b12d294b7e524cf8bdc 100644 (file)
@@ -2885,8 +2885,7 @@ size_t HUFv05_decompress (void* dst, size_t dstSize, const void* cSrc, size_t cS
 
     /* validation checks */
     if (dstSize == 0) return ERROR(dstSize_tooSmall);
-    if (cSrcSize > dstSize) return ERROR(corruption_detected);   /* invalid */
-    if (cSrcSize == dstSize) { memcpy(dst, cSrc, dstSize); return dstSize; }   /* not compressed */
+    if (cSrcSize >= dstSize) return ERROR(corruption_detected);   /* invalid, or not compressed, but not compressed already dealt with */
     if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; }   /* RLE */
 
     /* decoder timing evaluation */