[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kjs
From:       Maks Orlovich <maksim () kde ! org>
Date:       2009-05-10 14:19:45
Message-ID: 1241965185.842056.10453.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 966158 by orlovich:

automatically merged revision 966155:
Make sure to clip date value to the valid range in all paths.
This prevents freezes on 32-bit as we don't end up with magnitudes
so large that there is not enough precision to represent the year 
accurately.

It prevents crashes on 64-bit as we don't end up with time_t's corresponding to 
date's with a year  > 2^31 - 1, on which localtime/gmtime return 0.
Thanks to Zahl for info and for verifying this help on 64-bit..

BUG:189373

 M  +2 -2      date_object.cpp  


--- trunk/KDE/kdelibs/kjs/date_object.cpp #966157:966158
@@ -615,7 +615,7 @@
 
   if (id == SetTime) {
     double milli = roundValue(exec, args[0]);
-    result = jsNumber(milli);
+    result = jsNumber(timeClip(milli));
     thisDateObj->setInternalValue(result);
     return result;
   }
@@ -711,7 +711,7 @@
   if (id == SetYear || id == SetMilliSeconds || id == SetSeconds ||
       id == SetMinutes || id == SetHours || id == SetDate ||
       id == SetMonth || id == SetFullYear ) {
-    result = jsNumber(isnan(ms) ? ms : makeTime(&t, ms, utc));
+    result = jsNumber(isnan(ms) ? ms : timeClip(makeTime(&t, ms, utc)));
     thisDateObj->setInternalValue(result);
   }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic