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, ...@@ -1656,8 +1656,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
} else { } else {
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
start_code, buf_end - buf_ptr); start_code, buf_end - buf_ptr);
if ((ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size)) < 0) {
init_get_bits(&s->gb, unescaped_buf_ptr, unescaped_buf_size * 8); av_log(avctx, AV_LOG_ERROR, "invalid buffer\n");
goto fail;
}
s->start_code = start_code; s->start_code = start_code;
if (s->avctx->debug & FF_DEBUG_STARTCODE) 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