From 131c579b2c4e41fd4e80b2568b36fc329c143757 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Mon, 25 Oct 2010 11:08:19 +0530 Subject: [PATCH] Integer overflow for dashed lines longer than 46340 Lines of length greater than 46340 can be drawn with one of the coordinates being negative. However, miPolyBuildPoly overflows the int type when setting up edges for a section of the dashed line. This fix casts the results into long long so that the numbers don't wrap around and result in the line not being drawn at all. --- mi/miwideline.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mi/miwideline.c b/mi/miwideline.c index b11b40b..8a1567e 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 ((long long)slopes[j].dy * slopes[i].dx > (long long)slopes[i].dy * slopes[j].dx) { clockwise = -1; slopeoff = -1; -- 1.7.2.3