diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-05-15 20:41:41 +0400 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-05-21 11:46:02 +0400 |
commit | cfbd98abe82cfcb9984a18d08697251b72b110c8 (patch) | |
tree | 1cdd969d82f969452a2067132249768e87317c07 /libavcodec/mjpegdec.c | |
parent | c209d0df657f172f42d9bafbcdfa02dfb14f6965 (diff) |
mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
Prevent out of buffer write when decoding broken samples.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/mjpegdec.c')
-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 896fa996f0..934d1a2f92 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -941,6 +941,11 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int16_t *quant_matrix = s->quant_matrixes[s->quant_index[c]]; GetBitContext mb_bitmask_gb; + if (ss < 0 || ss >= 64 || + se < ss || se >= 64 || + Ah < 0 || Al < 0) + return AVERROR_INVALIDDATA; + if (mb_bitmask) init_get_bits(&mb_bitmask_gb, mb_bitmask, s->mb_width * s->mb_height); |