mjpeg_decode_dc: check code before using it in get_xbits()

Fixes undefined behavior

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/26/head
Michael Niedermayer 12 years ago
parent 58950ca0df
commit 6d6eabd399
  1. 2
      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]);

Loading…
Cancel
Save