From: Lasse Collin Date: Thu, 13 Jan 2011 01:01:17 +0000 (-0800) Subject: Decompressors: fix header validation in decompress_unlzma.c X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8218a437234309faa5725f82c33c3523788d5f68;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git Decompressors: fix header validation in decompress_unlzma.c Validation of header.pos calls error() but doesn't make the function return to indicate an error to the caller. Instead the decoding is attempted with invalid header.pos. This fixes it. Signed-off-by: Lasse Collin Cc: "H. Peter Anvin" Cc: Alain Knaff Cc: Albin Tonnerre Cc: Phillip Lougher Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 48173594ce01..696c34a274cf 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c @@ -574,8 +574,10 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len, ((unsigned char *)&header)[i] = *rc.ptr++; } - if (header.pos >= (9 * 5 * 5)) + if (header.pos >= (9 * 5 * 5)) { error("bad header"); + goto exit_1; + } mi = 0; lc = header.pos;