From 55482c1caf4dbe7f4735b75366bd4acd81937fc1 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 15 Oct 2019 13:40:01 -0400 Subject: [PATCH] render: Fix undefined shift in xRenderColorToCard32 Delightfully this is undefined even though CARD16 is an "unsigned" type, because it's an unsigned short, which C promotes to signed int because everything is stupid. --- render/picture.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/render/picture.c b/render/picture.c index c8f24f7f4..876316dc1 100644 --- a/render/picture.c +++ b/render/picture.c @@ -793,8 +793,10 @@ static CARD32 xRenderColorToCard32(xRenderColor c) { return - (c.alpha >> 8 << 24) | - (c.red >> 8 << 16) | (c.green & 0xff00) | (c.blue >> 8); + ((unsigned)c.alpha >> 8 << 24) | + ((unsigned)c.red >> 8 << 16) | + ((unsigned)c.green & 0xff00) | + ((unsigned)c.blue >> 8); } static void