summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2018-09-10 23:22:16 (GMT)
committerYann Collet <cyan@fb.com>2018-09-10 23:22:16 (GMT)
commit63fc6fbf7ee9e6a587598af085f22742cd9e6798 (patch)
tree937af8924de3e9c2c3a232a6cc28131b37ca0f17
parent32272f9866eb6d46e4457190cc7562ade2aa2ca8 (diff)
downloadlz4-63fc6fbf7ee9e6a587598af085f22742cd9e6798.zip
lz4-63fc6fbf7ee9e6a587598af085f22742cd9e6798.tar.gz
lz4-63fc6fbf7ee9e6a587598af085f22742cd9e6798.tar.bz2
restored nullifying output
to counter possible (offset==0)
-rw-r--r--lib/lz4.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index c68a7da..0545bbc 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1536,7 +1536,11 @@ LZ4_decompress_generic(
_copy_match:
if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error; /* Error : offset outside buffers */
- // LZ4_write32(op, (U32)offset); /* costs ~1%; silence an msan warning when offset==0 */ /* note : no longer valid with partialDecoding, since there is no guarantee that at least 4 bytes are available */
+ if (!partialDecoding) {
+ assert(oend > op);
+ assert(oend - op >= 4);
+ LZ4_write32(op, 0); /* silence an msan warning when offset==0; costs <1%; */
+ } /* note : when partialDecoding, there is no guarantee that at least 4 bytes remain available in output buffer */
if (length == ML_MASK) {
unsigned s;