+2014-11-12 Jon Beniston <jon@beniston.com>
+
+ * libc/stdlib/strtod.c (sulp): Cast to int32_t to avoid overflow.
+ * libc/time/gmtime_r.c (DAYS_PER_*_YEARS): Convert to long constants
+ to avoid overflow.
+
2014-11-10 Richard Earnshaw <rearnsha@arm.com>
* libc/machine/aarch64/strcpy.S: New file.
rv = ulp(dval(x));
if (!scale || (i = 2*P + 1 - ((dword0(x) & Exp_mask) >> Exp_shift)) <= 0)
return rv; /* Is there an example where i <= 0 ? */
- dword0(u) = Exp_1 + (i << Exp_shift);
+ dword0(u) = Exp_1 + ((__int32_t)i << Exp_shift);
#ifndef _DOUBLE_IS_32BITS
dword1(u) = 0;
#endif
#include "local.h"
-/* there are 97 leap years in 400-year periods */
-#define DAYS_PER_400_YEARS ((400 - 97) * 365 + 97 * 366)
-/* there are 24 leap years in 100-year periods */
-#define DAYS_PER_100_YEARS ((100 - 24) * 365 + 24 * 366)
+/* there are 97 leap years in 400-year periods. ((400 - 97) * 365 + 97 * 366) */
+#define DAYS_PER_400_YEARS 146097L
+/* there are 24 leap years in 100-year periods. ((100 - 24) * 365 + 24 * 366) */
+#define DAYS_PER_100_YEARS 36524L
/* there is one leap year every 4 years */
#define DAYS_PER_4_YEARS (3 * 365 + 366)