aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-10 19:09:47 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-05 12:43:08 +0200
commit24f824af860990e3f0bc747e1d6e87d20b7cfaf6 (patch)
tree37d951f0baa176421f5a83309dc2342e8b471ee6
parent8970824856ed2b08e54e2b013d377dd72f0ef27c (diff)
downloadffmpeg-24f824af860990e3f0bc747e1d6e87d20b7cfaf6.tar.gz
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/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 1ac106bf5625de6aec31a34319298032e988f349) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/nuv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 3d394b50c6..d9f0162a6d 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -123,7 +123,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)