aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/output.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-02-16 20:11:52 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-04-04 22:09:46 +0200
commite057e83a4ff4c0eeeb78dffe58e21af951c056b6 (patch)
treee1723816ddfc3e4c1bb73032f46e156ea3aa6ad5 /libswscale/output.c
parent49ba1879add99d3f64d70d34fb0255c8a49d4b28 (diff)
downloadffmpeg-e057e83a4ff4c0eeeb78dffe58e21af951c056b6.tar.gz
swscale/output: Fix integer overflow in yuv2rgb_write_full() with out of range input
Fixes: signed integer overflow: 1169365504 + 981452800 cannot be represented in type 'int' Fixes: ticket8293 Found-by: Suhwan Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale/output.c')
-rw-r--r--libswscale/output.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libswscale/output.c b/libswscale/output.c
index 9df6ba44c8..68f43ffba3 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1850,9 +1850,9 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c,
Y -= c->yuv2rgb_y_offset;
Y *= c->yuv2rgb_y_coeff;
Y += 1 << 21;
- R = Y + V*c->yuv2rgb_v2r_coeff;
- G = Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;
- B = Y + U*c->yuv2rgb_u2b_coeff;
+ R = (unsigned)Y + V*c->yuv2rgb_v2r_coeff;
+ G = (unsigned)Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;
+ B = (unsigned)Y + U*c->yuv2rgb_u2b_coeff;
if ((R | G | B) & 0xC0000000) {
R = av_clip_uintp2(R, 30);
G = av_clip_uintp2(G, 30);