diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-27 21:33:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-27 21:33:49 -0400 |
commit | 8dd68eb3cae6ec74ffbbe592ec7780e6e16e3913 (patch) | |
tree | c399c0b5c1ea68d5529a5c16ce13a3a777f0aa8f /lib/lz4/lz4_decompress.c | |
parent | 772205d8e4d87f22e74d9a6c05cf0e217a0e5f46 (diff) | |
parent | 4148c1f67abf823099b2d7db6851e4aea407f5ee (diff) |
Merge tag 'compress-3.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull compress bugfix from Greg KH:
"Here is another lz4 bugfix for 3.16-rc3 that resolves a reported issue
with that compression algorithm"
* tag 'compress-3.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
lz4: fix another possible overrun
Diffstat (limited to 'lib/lz4/lz4_decompress.c')
-rw-r--r-- | lib/lz4/lz4_decompress.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index 99a03acb7d47..b74da447e81e 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
@@ -108,6 +108,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
108 | if (length == ML_MASK) { | 108 | if (length == ML_MASK) { |
109 | for (; *ip == 255; length += 255) | 109 | for (; *ip == 255; length += 255) |
110 | ip++; | 110 | ip++; |
111 | if (unlikely(length > (size_t)(length + *ip))) | ||
112 | goto _output_error; | ||
111 | length += *ip++; | 113 | length += *ip++; |
112 | } | 114 | } |
113 | 115 | ||
@@ -157,7 +159,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
157 | 159 | ||
158 | /* write overflow error detected */ | 160 | /* write overflow error detected */ |
159 | _output_error: | 161 | _output_error: |
160 | return (int) (-(((char *)ip) - source)); | 162 | return -1; |
161 | } | 163 | } |
162 | 164 | ||
163 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | 165 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, |