summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-15 18:13:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-15 18:21:53 +0200
commit44c4170c52c10e3da3a7ea8e3435ef37c4edc2cc (patch)
tree962fd210000280e1c85e382e555b503f4497d49d /libavcodec
parenta63c813797fbdc32c530bf8930e11bf5a9a01d77 (diff)
lzw: check for overread
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/lzw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c
index 348d2de06b..19f3e110f4 100644
--- a/libavcodec/lzw.c
+++ b/libavcodec/lzw.c
@@ -190,6 +190,10 @@ int ff_lzw_decode(LZWState *p, uint8_t *buf, int len){
if ((--l) == 0)
goto the_end;
}
+ if (s->ebuf < s->pbuf) {
+ av_log(0, AV_LOG_ERROR, "lzw overread\n");
+ goto the_end;
+ }
c = lzw_get_code(s);
if (c == s->end_code) {
break;