summaryrefslogtreecommitdiffstats
path: root/lib/lzo/lzo1x_decompress_safe.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lzo/lzo1x_decompress_safe.c')
-rw-r--r--lib/lzo/lzo1x_decompress_safe.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/lzo/lzo1x_decompress_safe.c b/lib/lzo/lzo1x_decompress_safe.c
index 6d2600ea3b55..9e07e9ef1aad 100644
--- a/lib/lzo/lzo1x_decompress_safe.c
+++ b/lib/lzo/lzo1x_decompress_safe.c
@@ -54,11 +54,9 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
if (unlikely(in_len < 3))
goto input_overrun;
- if (likely(*ip == 17)) {
+ if (likely(in_len >= 5) && likely(*ip == 17)) {
bitstream_version = ip[1];
ip += 2;
- if (unlikely(in_len < 5))
- goto input_overrun;
} else {
bitstream_version = 0;
}