diff options
author | Michael Niedermayer | 2012-03-30 06:03:30 +0200 |
---|---|---|
committer | Michael Niedermayer | 2012-03-30 06:05:39 +0200 |
commit | 2b7c0c9fe10c2c702a3f2741d0f29b284f78d1ea (patch) | |
tree | ea8b7dfd1302e2288ab05a6297aa22058c7ee954 /libavcodec/lzw.c | |
parent | d3d5e84f33496f7c6ed704d53998db97a69f02e8 (diff) | |
parent | a05c41acd1e2dc0b7f6d82fa5ecbf7b8b5514ebc (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mp3dec: perform I/S and M/S only when frame mode is joint stereo.
id3v2: add another mimetype for JPEG image
lzw: prevent buffer overreads.
WMAL: Remove inaccurate and unnecessary doxy
h264: fix cabac-on-stack after safe cabac reader.
truemotion2: convert packet header reading to bytestream2.
Conflicts:
libavcodec/lzw.c
libavcodec/truemotion2.c
libavformat/id3v2.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/lzw.c')
-rw-r--r-- | libavcodec/lzw.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c index 2db0d67e7f..aed1a43fac 100644 --- a/libavcodec/lzw.c +++ b/libavcodec/lzw.c @@ -101,9 +101,14 @@ void ff_lzw_decode_tail(LZWState *p) struct LZWState *s = (struct LZWState *)p; if(s->mode == FF_LZW_GIF) { - while(s->pbuf + s->bs < s->ebuf && s->bs>0){ - s->pbuf += s->bs; - s->bs = *s->pbuf++; + 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; |