PR #23291 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23291
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23291.patch

Fixes: 
493055112/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5823995319746560
Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>


>From 9a2d28f2ea8fcca06db24665c94106d1c4f64229 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Sun, 31 May 2026 01:04:59 +0200
Subject: [PATCH] swscale/output: avoid signed overflow in yuv2rgba64_full_1
 alpha

Fixes: 
493055112/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5823995319746560
Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>
---
 libswscale/output.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 396380ac72..003bff63a1 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1499,7 +1499,7 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
 {
     const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
     int i;
-    int A = 0xffff<<14;
+    SUINT A = 0xffff<<14;
 
     if (uvalpha == 0) {
         for (i = 0; i < dstW; i++) {
@@ -1513,7 +1513,7 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
             Y += (1 << 13) - (1 << 29);
 
             if (hasAlpha) {
-                A = abuf0[i] * (1 << 11);
+                A = abuf0[i] * (SUINT)(1 << 11);
 
                 A += 1 << 13;
             }
@@ -1535,7 +1535,7 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
     } else {
         const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
         unsigned uvalpha1 = 4096 - uvalpha;
-        int A = 0xffff<<14;
+        SUINT A = 0xffff<<14;
         av_assert2(uvalpha <= 4096U);
 
         for (i = 0; i < dstW; i++) {
@@ -1549,7 +1549,7 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
             Y += (1 << 13) - (1 << 29);
 
             if (hasAlpha) {
-                A = abuf0[i] * (1 << 11);
+                A = abuf0[i] * (SUINT)(1 << 11);
 
                 A += 1 << 13;
             }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to