aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-08-26 13:37:15 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-08-26 15:39:51 -0400
commitf991975a9a3ac64c9df1767b45d84e6af3944d57 (patch)
tree3c2c9b6b74be16aa0304589c759f9a1fa59d8de0 /lib
parente0c7cbcada84aa70709673b0d0fba0ca5d11cb01 (diff)
parent0b8e8118dd2c9440bb7a2da1a19e15e324d3c09b (diff)
Merge tag 'v3.12.25' into v3.12-rt
This is the 3.12.25 stable release Conflicts: kernel/rtmutex.c
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,