Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: base/third_party/dmg_fp/exp_length.patch

Issue 2451573005: Fix integer-overflow in dmg_fp::strtod (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/third_party/dmg_fp/dtoa.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc 1 diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
2 index c0a51c2..ab4e056 100644 2 index c0a51c2..ab4e056 100644
3 --- a/base/third_party/dmg_fp/dtoa.cc 3 --- a/base/third_party/dmg_fp/dtoa.cc
4 +++ b/base/third_party/dmg_fp/dtoa.cc 4 +++ b/base/third_party/dmg_fp/dtoa.cc
5 @@ -2674,8 +2674,11 @@ strtod 5 @@ -2674,8 +2674,11 @@ strtod
6 if (c > '0' && c <= '9') { 6 if (c > '0' && c <= '9') {
7 L = c - '0'; 7 L = c - '0';
8 s1 = s; 8 s1 = s;
9 - while((c = *++s) >= '0' && c <= '9') 9 - while((c = *++s) >= '0' && c <= '9')
10 - L = 10*L + c - '0'; 10 - L = 10*L + c - '0';
11 + while((c = *++s) >= '0' && c <= '9') { 11 + while((c = *++s) >= '0' && c <= '9') {
12 + if (L < (INT_MAX - 10) / 10) { 12 + if (L < (INT_MAX - 10) / 10) {
13 +» » » » » » L = 10*L + c - '0'; 13 +» » » » » » L = 10*L + (c - '0');
14 + } 14 + }
15 + } 15 + }
16 if (s - s1 > 8 || L > 19999) 16 if (s - s1 > 8 || L > 19999)
17 /* Avoid confusion from exponents 17 /* Avoid confusion from exponents
18 * so large that e might overflow. 18 * so large that e might overflow.
OLDNEW
« no previous file with comments | « base/third_party/dmg_fp/dtoa.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698