From 3075ea01db452dd86c2e9422a6e61e67de264764 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 10 May 2014 10:38:47 +0200 Subject: sub: fix undefined behavior in ASS color calculation (2) Same problem as previous commit, fix by using the MP_ASS_RGBA() macro. --- sub/sd_ass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sub/sd_ass.c') diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 4ae7121bad..d29fefd277 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -446,10 +446,10 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts) int r = (color >> 24u) & 0xff; int g = (color >> 16u) & 0xff; int b = (color >> 8u) & 0xff; - int a = color & 0xff; + int a = 0xff - (color & 0xff); int c[3] = {r, g, b}; mp_map_int_color(vs_rgb2yuv, 8, c); mp_map_int_color(vs2rgb, 8, c); - sb->libass.color = (c[0] << 24u) | (c[1] << 16) | (c[2] << 8) | a; + sb->libass.color = MP_ASS_RGBA(c[0], c[1], c[2], a); } } -- cgit v1.2.3