diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-12-01 03:25:09 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2025-01-08 23:23:24 +0100 |
commit | 56faee21c136942c491f30a2e82cfbbfce180beb (patch) | |
tree | 73cc5e7529319f44d551391d2d2ac32082d63ec2 | |
parent | b5b6391d64807578ab872dc58fb8aa621dcfc38a (diff) | |
download | ffmpeg-56faee21c136942c491f30a2e82cfbbfce180beb.tar.gz |
swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
Fixes: signed integer overflow: -1082982400 + -1195645138 cannot be represented in type 'int'
Fixes: 376136843/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4791844321427456
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libswscale/output.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libswscale/output.c b/libswscale/output.c index 8407cc0abb..21c3bdc307 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -1355,9 +1355,9 @@ yuv2rgba64_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, B = U * c->yuv2rgb_u2b_coeff; // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit - output_pixel(&dest[0], av_clip_uintp2(((R_B + Y)>>14) + (1<<15), 16)); - output_pixel(&dest[1], av_clip_uintp2((( G + Y)>>14) + (1<<15), 16)); - output_pixel(&dest[2], av_clip_uintp2(((B_R + Y)>>14) + (1<<15), 16)); + output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + (unsigned)Y)>>14) + (1<<15), 16)); + output_pixel(&dest[1], av_clip_uintp2(((int)( G + (unsigned)Y)>>14) + (1<<15), 16)); + output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + (unsigned)Y)>>14) + (1<<15), 16)); if (eightbytes) { output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); dest += 4; |