mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-09 01:21:06 +00:00
swscale/output: avoid signed overflow in yuv2rgb_write_full luma scaling
Fixes: 523522305/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4574409678716928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
(cherry picked from commit f50e22c68d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -2003,8 +2003,8 @@ static av_always_inline void yuv2rgb_write_full(SwsInternal *c,
|
||||
int isrgb8 = target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8;
|
||||
|
||||
Y -= c->yuv2rgb_y_offset;
|
||||
Y *= c->yuv2rgb_y_coeff;
|
||||
Y += 1 << 21;
|
||||
Y *= (unsigned)c->yuv2rgb_y_coeff;
|
||||
Y += 1U << 21;
|
||||
R = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2r_coeff;
|
||||
G = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2g_coeff + U*(unsigned)c->yuv2rgb_u2g_coeff;
|
||||
B = (unsigned)Y + U*(unsigned)c->yuv2rgb_u2b_coeff;
|
||||
|
||||
Reference in New Issue
Block a user