Skip to content

Commit

Permalink
Decompressors: fix header validation in decompress_unlzma.c
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Larhzu authored and torvalds committed Jan 13, 2011
1 parent 22e4420 commit 8218a43
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/decompress_unlzma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8218a43

Please sign in to comment.