Decompressors: fix header validation in unlzma.c
authorLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Nov 2011 13:32:03 +0000 (14:32 +0100)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Nov 2011 13:32:03 +0000 (14:32 +0100)
From: Lasse Collin <lasse.collin@tukaani.org>

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 <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
xen/common/unlzma.c

index 7ecd161d56a4ec1651823727e188a20a8739fdc2..eb3fbba8263c5afbb3fadd6a05ed86eb1951ff0e 100644 (file)
@@ -568,8 +568,10 @@ STATIC int INIT unlzma(unsigned char *buf, unsigned 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;