[libxml2] Fix a schema type duration comparison overflow



commit bbcf1275fec28915b170db31fa9ea9bed0ea39a4
Author: Daniel Veillard <veillard redhat com>
Date:   Thu Nov 10 23:23:10 2011 +0800

    Fix a schema type duration comparison overflow
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653724
    
    Based on the fix suggested by Nick Pope <nick nickpope me uk>
    but just changing the casts to avoid using long long type

 xmlschemastypes.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 1a5454c..834b261 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -3569,8 +3569,8 @@ xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y)
 
     /* seconds */
     sec = x->value.dur.sec - y->value.dur.sec;
-    carry = (long)sec / SECS_PER_DAY;
-    sec -= (double)(carry * SECS_PER_DAY);
+    carry = (long)(sec / SECS_PER_DAY);
+    sec -= ((double)carry) * SECS_PER_DAY;
 
     /* days */
     day = x->value.dur.day - y->value.dur.day + carry;



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