diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-03-23 10:23:52 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-23 10:24:22 +0100 |
commit | 08c37a10e9ef7e30d7b7a889ad28c7fa9c49c886 (patch) | |
tree | 90cae3ea4e67980dfca90f1e59149e6371c06cb6 /libavcodec/mjpegdec.c | |
parent | 46c78429949239ec4eea23406332c4ae747ac8f2 (diff) | |
download | ffmpeg-08c37a10e9ef7e30d7b7a889ad28c7fa9c49c886.tar.gz |
mjpegdec: check h/v_count.
Fixes FPE
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-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 4c8015f44e..70798fd478 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -275,6 +275,10 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) s->h_max = s->h_count[i]; if (s->v_count[i] > s->v_max) s->v_max = s->v_count[i]; + if (!s->h_count[i] || !s->v_count[i]) { + av_log(s->avctx, AV_LOG_ERROR, "h/v_count is 0\n"); + return -1; + } s->quant_index[i] = get_bits(&s->gb, 8); if (s->quant_index[i] >= 4) return -1; |