summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-07 17:24:10 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-07 17:24:10 -0700
commit64c720add08ed48fc7655686c2de6969b043b4c0 (patch)
tree5c78f45d6089113f7e8f93fad22134646e42b15f /lib
parent868b60e0550247fc83630070ff64bbfb803b2347 (diff)
parentcd3de83f147601356395b57a8673e9c5ff1e59d1 (diff)
downloadlinux-exynos-64c720add08ed48fc7655686c2de6969b043b4c0.tar.gz
linux-exynos-64c720add08ed48fc7655686c2de6969b043b4c0.tar.bz2
linux-exynos-64c720add08ed48fc7655686c2de6969b043b4c0.zip
Merge 3.16-rc4 into driver-core-next
We want the lz* fixes here to do more work with them. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4/lz4_decompress.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index b74da447e81e..7a85967060a5 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -192,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
int s = 255;
while ((ip < iend) && (s == 255)) {
s = *ip++;
+ if (unlikely(length > (size_t)(length + s)))
+ goto _output_error;
length += s;
}
}
@@ -232,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
if (length == ML_MASK) {
while (ip < iend) {
int s = *ip++;
+ if (unlikely(length > (size_t)(length + s)))
+ goto _output_error;
length += s;
if (s == 255)
continue;
@@ -284,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
/* write overflow error detected */
_output_error:
- return (int) (-(((char *) ip) - source));
+ return -1;
}
int lz4_decompress(const unsigned char *src, size_t *src_len,