Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions icu4c/source/i18n/nfsubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1343,10 +1343,18 @@ NumeratorSubstitution::doParse(const UnicodeString& text,
int64_t n = result.getLong(status); // force conversion!
int64_t d = 1;
while (d <= n) {
if (d > U_INT64_MAX / 10) {
// Will cause int64_t overflow
return false;
}
d *= 10;
}
// now add the zeros
while (zeroCount > 0) {
if (d > U_INT64_MAX / 10) {
// Will cause int64_t overflow
return false;
}
d *= 10;
--zeroCount;
}
Expand Down