diff options
Diffstat (limited to 'thirdparty/icu4c/common/util_props.cpp')
-rw-r--r-- | thirdparty/icu4c/common/util_props.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/thirdparty/icu4c/common/util_props.cpp b/thirdparty/icu4c/common/util_props.cpp index 5991769d06..366a555eee 100644 --- a/thirdparty/icu4c/common/util_props.cpp +++ b/thirdparty/icu4c/common/util_props.cpp @@ -198,12 +198,11 @@ int32_t ICU_Utility::parseNumber(const UnicodeString& text, if (d < 0) { break; } - n = radix*n + d; - // ASSUME that when a 32-bit integer overflows it becomes - // negative. E.g., 214748364 * 10 + 8 => negative value. - if (n < 0) { + int64_t update = radix*static_cast<int64_t>(n) + d; + if (update > INT32_MAX) { return -1; } + n = static_cast<int32_t>(update); ++p; } if (p == pos) { |