[FFmpeg-devel] [PATCH 1/2] avcodec/mjpegdec: Check quant_matrixes values for being non zero

Michael Niedermayer michael at niedermayer.cc
Fri Mar 17 04:25:17 EET 2017


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/mjpegdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 4e78e1e3ae..b159cac197 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -188,6 +188,10 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
         /* read quant table */
         for (i = 0; i < 64; i++) {
             s->quant_matrixes[index][i] = get_bits(&s->gb, pr ? 16 : 8);
+            if (s->quant_matrixes[index][i] == 0) {
+                av_log(s->avctx, AV_LOG_ERROR, "dqt: 0 quant value\n");
+                return AVERROR_INVALIDDATA;
+            }
         }
 
         // XXX FIXME fine-tune, and perhaps add dc too
-- 
2.11.0



More information about the ffmpeg-devel mailing list