Decompressors: Fix header validation in decompress_unlzma.c
PATCH 1/4 Decompressors: Fix header validation in decompress_unlzma.c
From: Lasse Collin <[email protected]>
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]>
---
lib/decompress_unlzma.c renamed from lib/decompress_unlzma.c.orig +3 -1
@@ -580,8 +580,10 @@ STATIC inline int INIT unlzma(unsigned c ((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;