ICU-12572 Fixing signed overflow in decimalquantity.

X-SVN-Rev: 41293
This commit is contained in:
Shane Carr 2018-04-28 07:38:41 +00:00
parent 28e9f69378
commit c9680037cc

View file

@ -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;
}