avcodec/mjpegdec: Check quant_matrixes values for being non zero
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 17 Mar 2017 02:25:17 +0000 (03:25 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 20 Mar 2017 00:38:02 +0000 (01:38 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mjpegdec.c

index 8bf2fdf..af12d5d 100644 (file)
@@ -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