[FFmpeg-cvslog] mjpeg_decode_dc: check code before using it in get_xbits()

Michael Niedermayer git at videolan.org
Sun Jun 30 01:41:32 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jun 30 01:01:24 2013 +0200| [6d6eabd399eb20b69d10234ef746f2d3d4c72dcb] | committer: Michael Niedermayer

mjpeg_decode_dc: check code before using it in get_xbits()

Fixes undefined behavior

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mjpegdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index ef8e1c6..97a9ac9 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -493,7 +493,7 @@ static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)
 {
     int code;
     code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2);
-    if (code < 0) {
+    if (code < 0 || code > 16) {
         av_log(s->avctx, AV_LOG_WARNING,
                "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n",
                0, dc_index, &s->vlcs[0][dc_index]);



More information about the ffmpeg-cvslog mailing list