aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-24 03:28:49 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-04-13 00:35:15 +0200
commitdbe356a00974632a18612c7a395366cee4c49118 (patch)
tree14e2e3193d07001c56341d89bd9767276978578f /libavcodec
parentce82d4722bde503f899521519d3a8e8c2200c205 (diff)
downloadffmpeg-dbe356a00974632a18612c7a395366cee4c49118.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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mjpegdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index bd6dd7ef47..31c8fb422d 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -696,7 +696,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;