summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-20 22:01:41 -0700
committerJiri Slaby <jslaby@suse.cz>2014-07-02 12:05:51 +0200
commitf1bac1ba17822414d4031f840913b4ea27793ba8 (patch)
treed0b54a8c617ad14874d941dba467d3428abfb39f /lib
parent83722ba4bdfa951767cb47ee8aad5fd44350066f (diff)
lz4: ensure length does not wrap
commit 206204a1162b995e2185275167b22468c00d6b36 upstream. Given some pathologically compressed data, lz4 could possibly decide to wrap a few internal variables, causing unknown things to happen. Catch this before the wrapping happens and abort the decompression. Reported-by: "Don A. Bailey" <donb@securitymouse.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4/lz4_decompress.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index df6839e3ce08..99a03acb7d47 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -72,6 +72,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
len = *ip++;
for (; len == 255; length += 255)
len = *ip++;
+ if (unlikely(length > (size_t)(length + len)))
+ goto _output_error;
length += len;
}