Skip to content

Commit 206204a

Browse files
committed
lz4: ensure length does not wrap
Given some pathologically compressed data, lz4 could possibly decide to wrap a few internal variables, causing unknown things to happen. Catch this before the wrapping happens and abort the decompression. Reported-by: "Don A. Bailey" <donb@securitymouse.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 206a81c commit 206204a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: lib/lz4/lz4_decompress.c

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
7272
len = *ip++;
7373
for (; len == 255; length += 255)
7474
len = *ip++;
75+
if (unlikely(length > (size_t)(length + len)))
76+
goto _output_error;
7577
length += len;
7678
}
7779

0 commit comments

Comments
 (0)