diff mbox series

[FFmpeg-devel] avcodec/osq: avoid signed overflow in downsample path

Message ID 20240621193548.2923736-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avcodec/osq: avoid signed overflow in downsample path | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer June 21, 2024, 7:35 p.m. UTC
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 <michael@niedermayer.cc>
---
 libavcodec/osq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/osq.c b/libavcodec/osq.c
index 8a153330269..42a46b25ce5 100644
--- a/libavcodec/osq.c
+++ b/libavcodec/osq.c
@@ -325,7 +325,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];