Commit 9e7f4fb97e for ffmpeg

commit 9e7f4fb97ea95142256b4c6dfa0e3b6588b6e0d8
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Mon Nov 16 06:56:47 2026 +0100

    swscale/output: avoid signed overflow in yuv2gbrpf32_full_X_c()

    The chroma products and the sums are computed like in yuv2gbrp16_full_X_c()

    Found during review of the fix for the OSS-Fuzz issue 574937224

    Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

diff --git a/libswscale/output.c b/libswscale/output.c
index 463de1d9d2..cf3cea8955 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2595,13 +2595,13 @@ yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter,
         Y -= c->yuv2rgb_y_offset;
         Y *= c->yuv2rgb_y_coeff;
         Y += (1 << 13) - (1 << 29);
-        R = V * c->yuv2rgb_v2r_coeff;
-        G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
-        B =                            U * c->yuv2rgb_u2b_coeff;
+        R = V * (unsigned)c->yuv2rgb_v2r_coeff;
+        G = V * (unsigned)c->yuv2rgb_v2g_coeff + U * (unsigned)c->yuv2rgb_u2g_coeff;
+        B =                                      U * (unsigned)c->yuv2rgb_u2b_coeff;

-        R = av_clip_uintp2(((Y + R) >> 14) + (1<<15), 16);
-        G = av_clip_uintp2(((Y + G) >> 14) + (1<<15), 16);
-        B = av_clip_uintp2(((Y + B) >> 14) + (1<<15), 16);
+        R = av_clip_uintp2(((Y + (int64_t)R) >> 14) + (1<<15), 16);
+        G = av_clip_uintp2(((Y + (int64_t)G) >> 14) + (1<<15), 16);
+        B = av_clip_uintp2(((Y + (int64_t)B) >> 14) + (1<<15), 16);

         dest32[0][i] = av_float2int(float_mult * (float)G);
         dest32[1][i] = av_float2int(float_mult * (float)B);