Commit aa28c425 authored by Michael Niedermayer's avatar Michael Niedermayer

mjpegdec: check buffer before using it

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 551f6838
......@@ -1656,8 +1656,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
} else {
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
start_code, buf_end - buf_ptr);
init_get_bits(&s->gb, unescaped_buf_ptr, unescaped_buf_size * 8);
if ((ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid buffer\n");
goto fail;
}
s->start_code = start_code;
if (s->avctx->debug & FF_DEBUG_STARTCODE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment