projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
528941c
)
Decompressors: validate match distance in decompress_unlzma.c
author
Lasse Collin
<
[email protected]
>
Thu, 13 Jan 2011 01:01:19 +0000
(17:01 -0800)
committer
Linus Torvalds
<
[email protected]
>
Thu, 13 Jan 2011 16:03:24 +0000
(08:03 -0800)
Validate the newly decoded distance (rep0) in process_bit1(). This is to
detect corrupt LZMA data quickly. The old code can run for long time
producing garbage until it hits the end of the input.
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
patch
|
blob
|
history
diff --git
a/lib/decompress_unlzma.c
b/lib/decompress_unlzma.c
index f30c899241ef2d7e869194c08cc58765a684b4ba..476c65af97098bb0e117999a645fe9c03192ceb5 100644
(file)
--- a/
lib/decompress_unlzma.c
+++ b/
lib/decompress_unlzma.c
@@
-522,6
+522,9
@@
static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
cst->rep0 = pos_slot;
if (++(cst->rep0) == 0)
return 0;
+ if (cst->rep0 > wr->header->dict_size
+ || cst->rep0 > get_pos(wr))
+ return -1;
}
len += LZMA_MATCH_MIN_LEN;