[FFmpeg-cvslog] mjpegdec: make sure we dont interpret things after the bitstream buffer as resync marker

Michael Niedermayer git at videolan.org
Sat Sep 17 01:48:16 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Sep 17 01:32:08 2011 +0200| [b002184fa1665a8a7054c38811085071623349cb] | committer: Michael Niedermayer

mjpegdec: make sure we dont interpret things after the bitstream buffer as resync marker
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b002184fa1665a8a7054c38811085071623349cb
---

 libavcodec/mjpegdec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index c44a0ee..d91effd 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -898,9 +898,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
             if (s->restart_interval && show_bits(&s->gb, i)  == (1<<i)-1){ /* skip RSTn */
                 int pos= get_bits_count(&s->gb);
                 align_get_bits(&s->gb);
-                while(show_bits(&s->gb, 8) == 0xFF)
+                while(get_bits_count(&s->gb) < s->gb.size_in_bits && show_bits(&s->gb, 8) == 0xFF)
                     skip_bits(&s->gb, 8);
-                if((get_bits(&s->gb, 8)&0xF8) == 0xD0){
+                if(get_bits_count(&s->gb) < s->gb.size_in_bits && (get_bits(&s->gb, 8)&0xF8) == 0xD0){
                     for (i=0; i<nb_components; i++) /* reset dc */
                         s->last_dc[i] = 1024;
                 }else{



More information about the ffmpeg-cvslog mailing list