From c9680037ccfcf5f7e989dab5a6de8912b39efe2f Mon Sep 17 00:00:00 2001 From: Shane Carr Date: Sat, 28 Apr 2018 07:38:41 +0000 Subject: [PATCH] ICU-12572 Fixing signed overflow in decimalquantity. X-SVN-Rev: 41293 --- icu4c/source/i18n/number_decimalquantity.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/icu4c/source/i18n/number_decimalquantity.cpp b/icu4c/source/i18n/number_decimalquantity.cpp index 599d35d2701..18f11c4a328 100644 --- a/icu4c/source/i18n/number_decimalquantity.cpp +++ b/icu4c/source/i18n/number_decimalquantity.cpp @@ -328,7 +328,10 @@ bool DecimalQuantity::isZero() const { DecimalQuantity &DecimalQuantity::setToInt(int32_t n) { setBcdToZero(); flags = 0; - if (n < 0) { + if (n == INT32_MIN) { + flags |= NEGATIVE_FLAG; + // leave as INT32_MIN; handled below in _setToInt() + } else if (n < 0) { flags |= NEGATIVE_FLAG; n = -n; }