[xml] [PATCH] Prevent overflow on duration comparison 32-bit.



See https://bugzilla.gnome.org/show_bug.cgi?id=653724
---
 xmlschemastypes.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 1a5454c..80725b4 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -3553,7 +3553,8 @@ xmlSchemaCompareDecimals(xmlSchemaValPtr x, xmlSchemaValPtr y)
 static int
 xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y)
 {
-    long carry, mon, day;
+    long long carry;
+    long mon, day;
     double sec;
     int invert = 1;
     long xmon, xday, myear, minday, maxday;
@@ -3569,7 +3570,7 @@ xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y)
 
     /* seconds */
     sec = x->value.dur.sec - y->value.dur.sec;
-    carry = (long)sec / SECS_PER_DAY;
+    carry = (long long)sec / SECS_PER_DAY;
     sec -= (double)(carry * SECS_PER_DAY);
 
     /* days */
-- 
1.7.1




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]