mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 08:42:39 +00:00
lzw: prevent buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
This commit is contained in:
parent
28e8c4d59a
commit
ddcf67c8a5
@ -101,10 +101,15 @@ void ff_lzw_decode_tail(LZWState *p)
|
||||
struct LZWState *s = (struct LZWState *)p;
|
||||
|
||||
if(s->mode == FF_LZW_GIF) {
|
||||
while(s->pbuf < s->ebuf && s->bs>0){
|
||||
while (s->bs > 0) {
|
||||
if (s->pbuf + s->bs >= s->ebuf) {
|
||||
s->pbuf = s->ebuf;
|
||||
break;
|
||||
} else {
|
||||
s->pbuf += s->bs;
|
||||
s->bs = *s->pbuf++;
|
||||
}
|
||||
}
|
||||
}else
|
||||
s->pbuf= s->ebuf;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user