Decompressors: fix header validation in decompress_unlzma.c
authorLasse Collin <[email protected]>
Thu, 13 Jan 2011 01:01:17 +0000 (17:01 -0800)
committerLinus Torvalds <[email protected]>
Thu, 13 Jan 2011 16:03:24 +0000 (08:03 -0800)
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 <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Alain Knaff <[email protected]>
Cc: Albin Tonnerre <[email protected]>
Cc: Phillip Lougher <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
lib/decompress_unlzma.c

index 48173594ce01400d2fca2d61423e94f4edf5fb6e..696c34a274cf2df7eec8b7a175a9c886e11b882b 100644 (file)
@@ -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;