diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc | |
index c0a51c2..ab4e056 100644 | |
--- a/base/third_party/dmg_fp/dtoa.cc | |
+++ b/base/third_party/dmg_fp/dtoa.cc | |
@@ -2674,8 +2674,11 @@ strtod | |
if (c > '0' && c <= '9') { | |
L = c - '0'; | |
s1 = s; | |
- while((c = *++s) >= '0' && c <= '9') | |
- L = 10*L + c - '0'; | |
+ while((c = *++s) >= '0' && c <= '9') { | |
+ if (L < (INT_MAX - 10) / 10) { | |
+ L = 10*L + (c - '0'); | |
+ } | |
+ } | |
if (s - s1 > 8 || L > 19999) | |
/* Avoid confusion from exponents | |
* so large that e might overflow. |