diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-13 16:51:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-13 17:39:11 +0200 |
commit | dc35a58149c27a3ae2d47a7a393a77a8987454ac (patch) | |
tree | e2ffaecd66ffa5cbfc113c6655a4004f54d811ac | |
parent | 6d3f17838db93647f026338cb63103ce57f5d0e2 (diff) | |
download | ffmpeg-dc35a58149c27a3ae2d47a7a393a77a8987454ac.tar.gz |
avcodec/mjpegdec: Check len in ff_mjpeg_decode_dqt()
Fixes CID1239060
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/mjpegdec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 2d6451ce90..2e019d99c5 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -163,6 +163,11 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s) len = get_bits(&s->gb, 16) - 2; + if (8*len > get_bits_left(&s->gb)) { + av_log(s->avctx, AV_LOG_ERROR, "dqt: len %d is too large\n", len); + return AVERROR_INVALIDDATA; + } + while (len >= 65) { int pr = get_bits(&s->gb, 4); if (pr > 1) { |