From 18025bf362a1ac00efb78616404f821acf734352 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 21 Jun 2024 21:35:48 +0200 Subject: [PATCH] avcodec/osq: avoid signed overflow in downsample path Fixes: signed integer overflow: 865309950 * 256 cannot be represented in type 'int' Fixes: 69191/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6310214413385728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit ed34b0c54ebdce7f741d9fb6a9ac11a1816df59c) Signed-off-by: Michael Niedermayer --- libavcodec/osq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/osq.c b/libavcodec/osq.c index 650cfcd98c..fa4aeee35e 100644 --- a/libavcodec/osq.c +++ b/libavcodec/osq.c @@ -320,7 +320,7 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int cb->prev = prev; if (downsample) - dst[n] *= 256; + dst[n] *= 256U; dst[E] = dst[D]; dst[D] = dst[C];