summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2019-05-31 19:23:52 (GMT)
committerGitHub <noreply@github.com>2019-05-31 19:23:52 (GMT)
commit8008fdf396ae0a2d12a18bfd3fc2b033e3648fa6 (patch)
tree4833cf4f8b683ec32102067952d5b728ffac7541
parentb77c9c062dcffedd25ccc18a8b59330a270c8677 (diff)
parent64b5917736396754a8f93c2913f5276361831b39 (diff)
downloadlz4-8008fdf396ae0a2d12a18bfd3fc2b033e3648fa6.zip
lz4-8008fdf396ae0a2d12a18bfd3fc2b033e3648fa6.tar.gz
lz4-8008fdf396ae0a2d12a18bfd3fc2b033e3648fa6.tar.bz2
Merge pull request #719 from parheliamm/dev
FAST_DEC_LOOP: move offset check in specific condition.
-rw-r--r--lib/lz4.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 070dd7e..9e6999f 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1708,10 +1708,9 @@ LZ4_decompress_generic(
/* get matchlength */
length = token & ML_MASK;
- if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) { goto _output_error; } /* Error : offset outside buffers */
-
if (length == ML_MASK) {
variable_length_error error = ok;
+ if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) { goto _output_error; } /* Error : offset outside buffers */
length += read_variable_length(&ip, iend - LASTLITERALS + 1, endOnInput, 0, &error);
if (error != ok) { goto _output_error; }
if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
@@ -1735,6 +1734,7 @@ LZ4_decompress_generic(
continue;
} } }
+ if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) { goto _output_error; } /* Error : offset outside buffers */
/* match starting within external dictionary */
if ((dict==usingExtDict) && (match < lowPrefix)) {
if (unlikely(op+length > oend-LASTLITERALS)) {