[Pixman] [PATCH 2/2] Update pixman_trapezoid_valid to reject trapezoids where where top (botttom) is above (below) the edges, correctly.

Ritesh Khadgaray ritesh.khadgaray at canonical.com
Thu Nov 14 07:41:05 PST 2013


From: Ritesh Khadgaray <ritesh.khadgaray at canonical.com>

Check if bottom is below top. Subtracting bottom from top can lead to underflow
when working with negative values, leading to validate an invalid trapezoid.

This fixes 67484.
---
 pixman/pixman.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pixman/pixman.h b/pixman/pixman.h
index 7ff9fb5..509ba5e 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -1030,7 +1030,7 @@ struct pixman_triangle
 #define pixman_trapezoid_valid(t)				   \
     ((t)->left.p1.y != (t)->left.p2.y &&			   \
      (t)->right.p1.y != (t)->right.p2.y &&			   \
-     (int) ((t)->bottom - (t)->top) > 0)
+     ((t)->bottom > (t)->top))
 
 struct pixman_span_fix
 {
-- 
1.8.3.2



More information about the Pixman mailing list