diff options
Diffstat (limited to 'lib/lz4')
-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, |