Jan Engelhardt
370f2dda3b
- nan-undefined-conversion.patch: ICU-21613 Fix undefined behaviour in ComplexUnitsConverter::applyRounder OBS-URL: https://build.opensuse.org/request/show/892508 OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/icu?expand=0&rev=149
21 lines
803 B
Diff
21 lines
803 B
Diff
From 29f1188d191a7a75ac7ffa4bfa390f625da39c53 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schwab <schwab@suse.de>
|
|
Date: Tue, 11 May 2021 19:04:24 +0200
|
|
Subject: [PATCH] ICU-21613 Fix undefined behaviour in
|
|
ComplexUnitsConverter::applyRounder
|
|
|
|
--- a/source/i18n/units_complexconverter.cpp
|
|
+++ b/source/i18n/units_complexconverter.cpp
|
|
@@ -237,6 +237,11 @@ void ComplexUnitsConverter::applyRounder(MaybeStackArray<int64_t, 5> &intValues,
|
|
}
|
|
quantity = decimalQuantity.toDouble();
|
|
|
|
+ if (uprv_isNaN(quantity) || uprv_isInfinite(quantity)) {
|
|
+ // Do nothing for non-finite values, since conversion to int64_t is undefined
|
|
+ return;
|
|
+ }
|
|
+
|
|
int32_t lastIndex = unitsConverters_.length() - 1;
|
|
if (lastIndex == 0) {
|
|
// Only one element, no need to bubble up the carry
|