diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-29 04:36:49 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-29 05:00:15 +0100 |
commit | aa28c42534383ae1e2055d66a49c009e8234d18f (patch) | |
tree | 9d90b30b52509710bda1f1b5199db3b87be6d0ac /libavcodec | |
parent | 551f683861bbae1002542e70dc196244a1cd24ad (diff) | |
download | ffmpeg-streaming-aa28c42534383ae1e2055d66a49c009e8234d18f.zip ffmpeg-streaming-aa28c42534383ae1e2055d66a49c009e8234d18f.tar.gz |
mjpegdec: check buffer before using it
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mjpegdec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 5880fec..b9fe555 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -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) |