diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2012-02-23 12:22:40 -0800 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2012-02-26 10:03:16 +0100 |
commit | bf6d1a1ca792e4207e5d9b71c5020befb2296ae3 (patch) | |
tree | 7b1d51895d809a19ae34c69cc02f531cc0e6e0ba | |
parent | 424b6edd1944cf02261109edb5913417cf8e5dfb (diff) | |
download | ffmpeg-bf6d1a1ca792e4207e5d9b71c5020befb2296ae3.tar.gz |
mjpeg: abort decoding if packet is too large.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ab492ca2ab105aeb24d955f3f03756bdb3139ee1)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r-- | libavcodec/mjpegdec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 2ae502ddeb..49d334bb7e 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1466,6 +1466,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size, /* EOF */ if (start_code < 0) { goto the_end; + } else if (unescaped_buf_size > (1U<<29)) { + av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (0x%x/0x%x), corrupt data?\n", + start_code, unescaped_buf_ptr, buf_size); + return AVERROR_INVALIDDATA; } else { av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr); |