diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-30 01:01:24 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-30 01:35:22 +0200 |
commit | 6d6eabd399eb20b69d10234ef746f2d3d4c72dcb (patch) | |
tree | f1e22bbd1f9d53099c55ac128f41632b363ff934 /libavcodec | |
parent | 58950ca0df678da99d870fe2e620672ce5d43c1b (diff) | |
download | ffmpeg-6d6eabd399eb20b69d10234ef746f2d3d4c72dcb.tar.gz |
mjpeg_decode_dc: check code before using it in get_xbits()
Fixes undefined behavior
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mjpegdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index ef8e1c6ba2..97a9ac996e 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]); |