Commit 4148c1f6 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

lz4: fix another possible overrun

There is one other possible overrun in the lz4 code as implemented by
Linux at this point in time (which differs from the upstream lz4
codebase, but will get synced at in a future kernel release.)  As
pointed out by Don, we also need to check the overflow in the data

While we are at it, replace the odd error return value with just a
"simple" -1 value as the return value is never used for anything other
than a basic "did this work or not" check.

Reported-by: default avatar"Don A. Bailey" <>
Reported-by: default avatarWilly Tarreau <>
Cc: stable <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 206204a1
......@@ -108,6 +108,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
if (length == ML_MASK) {
for (; *ip == 255; length += 255)
if (unlikely(length > (size_t)(length + *ip)))
goto _output_error;
length += *ip++;
......@@ -157,7 +159,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
/* write overflow error detected */
return (int) (-(((char *)ip) - source));
return -1;
static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment