[Pixman] [PATCH 4/5] In MUL_UNc() cast to comp2_t

Søren Sandmann sandmann at cs.au.dk
Thu Dec 22 13:35:45 PST 2011


From: Søren Sandmann Pedersen <ssp at redhat.com>

Otherwise, when comp1_t is 16 bits wide, we can end up with a signed
integer overflow.
---
 pixman/pixman-combine.h.template |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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))
-- 
1.6.0.6



More information about the Pixman mailing list