aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-20 22:01:41 -0700
committerSimon Shields <keepcalm444@gmail.com>2016-06-12 21:20:11 +1000
commit69a113aae3d8c2753f68d0b64f0219d9cc6e493f (patch)
treec6582ca7a9a2bcf4baeabea2f5fb723aa0c9f8a4 /lib
parentfab4f77d0ecc98293ec060bc9c77303db7dbdc46 (diff)
downloadkernel_samsung_smdk4412-69a113aae3d8c2753f68d0b64f0219d9cc6e493f.tar.gz
kernel_samsung_smdk4412-69a113aae3d8c2753f68d0b64f0219d9cc6e493f.tar.bz2
kernel_samsung_smdk4412-69a113aae3d8c2753f68d0b64f0219d9cc6e493f.zip
lz4: ensure length does not wrap
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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 df6839e3ce0..99a03acb7d4 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;
}