Commit 1bfc1aa0 authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent c6939f65
......@@ -715,7 +715,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment