ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Sun 
Dec  1 03:31:56 2024 +0100| [0f511b4518fa4337f603275f865eb13ac5520d0f] | 
committer: Michael Niedermayer

avcodec/osq: Fixes several undefined overflows in do_decode()

Fixes: signed integer overflow: 1239596184 + 2119376059 cannot be represented 
in type 'int'
Fixes: 
376136844/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6581164455821312

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f511b4518fa4337f603275f865eb13ac5520d0f
---

 libavcodec/osq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/osq.c b/libavcodec/osq.c
index 1bf6264699..83b4a9d618 100644
--- a/libavcodec/osq.c
+++ b/libavcodec/osq.c
@@ -300,7 +300,7 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, 
int decorrelate, int
                 dst[n] += (int)(P2 + P3) / 2 + (unsigned)p;
                 break;
             case 8:
-                dst[n] += (int)(P2 + P3) / 2;
+                dst[n] += (int)(P2 + P3) / 2 + 0U;
                 break;
             case 9:
                 dst[n] += (int)(P2 * 2 + P3) / 3 + (unsigned)p;
@@ -309,13 +309,13 @@ static int do_decode(AVCodecContext *avctx, AVFrame 
*frame, int decorrelate, int
                 dst[n] += (int)(P2 + P3 * 2) / 3 + (unsigned)p;
                 break;
             case 11:
-                dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2;
+                dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2 + 0U;
                 break;
             case 12:
                 dst[n] += (unsigned)dst[B];
                 break;
             case 13:
-                dst[n] += (int)(unsigned)(dst[D] + dst[B]) / 2;
+                dst[n] += (int)((unsigned)dst[D] + dst[B]) / 2 + 0U;
                 break;
             case 14:
                 dst[n] += (int)((unsigned)P2 + dst[A]) / 2 + (unsigned)p;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to