avcodec/mjpegdec: Fix DC overflow in decode_block()
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 15 Jul 2015 02:59:35 +0000 (04:59 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 15 Jul 2015 03:05:25 +0000 (05:05 +0200)
Fixes Ticket4683

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mjpegdec.c

index f85eabf..8094274 100644 (file)
@@ -672,6 +672,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
         return AVERROR_INVALIDDATA;
     }
     val = val * quant_matrix[0] + s->last_dc[component];
+    val = FFMIN(val, 32767);
     s->last_dc[component] = val;
     block[0] = val;
     /* AC coefs */