diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-13 17:41:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-13 17:44:35 +0200 |
commit | cf9ab119d02dd8a80b37df02007d488aae5a2b80 (patch) | |
tree | 42d3fb61829c7f2251009a45715312b18c64b9be /libavcodec | |
parent | dc35a58149c27a3ae2d47a7a393a77a8987454ac (diff) | |
download | ffmpeg-cf9ab119d02dd8a80b37df02007d488aae5a2b80.tar.gz |
avcodec/mjpegdec: Check len in ff_mjpeg_decode_dht()
Fixes CID1239167
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-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 2e019d99c5..b3dc246391 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -204,6 +204,11 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) len = get_bits(&s->gb, 16) - 2; + if (8*len > get_bits_left(&s->gb)) { + av_log(s->avctx, AV_LOG_ERROR, "dht: len %d is too large\n", len); + return AVERROR_INVALIDDATA; + } + while (len > 0) { if (len < 17) return AVERROR_INVALIDDATA; |