From: Søren Sandmann Pedersen Date: Tue, 20 Dec 2011 11:34:41 +0000 (-0500) Subject: In MUL_UNc() cast to comp2_t X-Git-Tag: pixman-0.25.2~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a8192b6dd88b833bb918de28331d3a85c84a4f7;p=platform%2Fupstream%2Fpixman.git In MUL_UNc() cast to comp2_t Otherwise, when comp1_t is 16 bits wide, we can end up with a signed integer overflow. --- diff --git a/pixman/pixman-combine.h.template b/pixman/pixman-combine.h.template index 67ed309..53afcd2 100644 --- a/pixman/pixman-combine.h.template +++ b/pixman/pixman-combine.h.template @@ -25,7 +25,7 @@ */ #define MUL_UNc(a, b, t) \ - ((t) = (a) * (b) + ONE_HALF, ((((t) >> G_SHIFT ) + (t) ) >> G_SHIFT )) + ((t) = (a) * (comp2_t)(b) + ONE_HALF, ((((t) >> G_SHIFT ) + (t) ) >> G_SHIFT )) #define DIV_UNc(a, b) \ (((comp2_t) (a) * MASK) / (b))