summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-09-07 19:48:24 (GMT)
committerYann Collet <cyan@fb.com>2017-09-07 19:48:24 (GMT)
commitb500c5282e61027b797d3fd39e7d4ab1ab084adf (patch)
tree8b5863e77c771eff0edc53838b3e9e79b3c72072 /lib
parent00418f76115e3c435b4cb0e41b30fba8e8e3adee (diff)
downloadlz4-b500c5282e61027b797d3fd39e7d4ab1ab084adf.zip
lz4-b500c5282e61027b797d3fd39e7d4ab1ab084adf.tar.gz
lz4-b500c5282e61027b797d3fd39e7d4ab1ab084adf.tar.bz2
fix #397 : decompression failed when using a combination of extDict + low memory address
Reported and fixed by @jscheid Note : we are missing a test case to include it in the CI
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index f361b22..0960c97 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1127,7 +1127,6 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
BYTE* const oend = op + outputSize;
BYTE* cpy;
BYTE* oexit = op + targetOutputSize;
- const BYTE* const lowLimit = lowPrefix - dictSize;
const BYTE* const dictEnd = (const BYTE*)dictStart + dictSize;
const unsigned dec32table[] = {0, 1, 2, 1, 4, 4, 4, 4};
@@ -1183,7 +1182,7 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
/* get offset */
offset = LZ4_readLE16(ip); ip+=2;
match = op - offset;
- if ((checkOffset) && (unlikely(match < lowLimit))) goto _output_error; /* Error : offset outside buffers */
+ 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 */
/* get matchlength */