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

avcodec/nuv: widen buf_size type

Fixes: signed integer overflow: 65312 * 65312 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5740176118906880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent fabeef22
......@@ -126,7 +126,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height,
get_quant_quality(c, quality);
if (width != c->width || height != c->height) {
// also reserve space for a possible additional header
int buf_size = height * width * 3 / 2
int64_t buf_size = height * (int64_t)width * 3 / 2
+ FFMAX(AV_LZO_OUTPUT_PADDING, AV_INPUT_BUFFER_PADDING_SIZE)
+ RTJPEG_HEADER_SIZE;
if (buf_size > INT_MAX/8)
......
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