[PATCH] mi: Integer overflow for dashed lines longer than 46340. #31093

Siddhesh Poyarekar siddhesh.poyarekar at gmail.com
Mon Oct 25 20:41:53 PDT 2010


Lines of length greater than 46340 can be drawn with one of the
coordinates being negative. However for dashed lines, miPolyBuildPoly
overflows the int type when setting up edges for a section of the
dashed line. This results in the dashed segments not being drawn at
all.

Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar at gmail.com>
---
 mi/miwideline.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mi/miwideline.c b/mi/miwideline.c
index b11b40b..bc5ee74 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -403,7 +403,7 @@ miPolyBuildPoly (
     i = top;
     j = StepAround (top, -1, count);
 
-    if (slopes[j].dy * slopes[i].dx > slopes[i].dy * slopes[j].dx)
+    if ((int64_t)slopes[j].dy * slopes[i].dx > (int64_t)slopes[i].dy * slopes[j].dx)
     {
 	clockwise = -1;
 	slopeoff = -1;
-- 
1.7.2.3



More information about the xorg-devel mailing list