Skip to content

Commit ce538ef

Browse files
committed
swscale/output: Fix integer overflow in yuv2gbrp_full_X_c()
Fixes: signed integer overflow: 1966895953 + 210305024 cannot be represented in type 'int' Fixes: 391921975/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5916798905548800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
1 parent 3aec1f8 commit ce538ef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libswscale/output.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,9 +2317,9 @@ yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter,
23172317
Y -= c->yuv2rgb_y_offset;
23182318
Y *= c->yuv2rgb_y_coeff;
23192319
Y += 1 << (SH-1);
2320-
R = Y + V * c->yuv2rgb_v2r_coeff;
2321-
G = Y + V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
2322-
B = Y + U * c->yuv2rgb_u2b_coeff;
2320+
R = Y + V * (unsigned)c->yuv2rgb_v2r_coeff;
2321+
G = Y + V * (unsigned)c->yuv2rgb_v2g_coeff + U * (unsigned)c->yuv2rgb_u2g_coeff;
2322+
B = Y + U * (unsigned)c->yuv2rgb_u2b_coeff;
23232323

23242324
if ((R | G | B) & 0xC0000000) {
23252325
R = av_clip_uintp2(R, 30);

0 commit comments

Comments
 (0)