diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-01-24 03:28:49 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-01-31 23:47:15 +0100 |
commit | c1f7b2b6e18acf0b24fcac32027e5ca45e3b5945 (patch) | |
tree | 27441af4a1d6f8261ead22bf290122e8389b3ed7 | |
parent | 193b6df3572f5ffa692824b28c1c990aeed0880f (diff) | |
download | ffmpeg-c1f7b2b6e18acf0b24fcac32027e5ca45e3b5945.tar.gz |
avcodec/mjpegdec: Fix integer overflow in DC dequantization
Fixes: runtime error: signed integer overflow: -65535 * 65312 cannot be represented in type 'int'
Fixes: 4900/clusterfuzz-testcase-minimized-5769019744321536
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1bfc1aa004950c5ad527d823a08b8a19eef34eb0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mjpegdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index f6011c76f9..befbb0a25a 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -686,7 +686,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } - val = val * quant_matrix[0] + s->last_dc[component]; + val = val * (unsigned)quant_matrix[0] + s->last_dc[component]; val = av_clip_int16(val); s->last_dc[component] = val; block[0] = val; |