Refresh ICU-20246 patch from maint/maint-63

No functional change, just adds the testcase back in that wasn't
applicable to ICU 62.1
This commit is contained in:
Eike Rathke 2019-02-20 18:12:44 +01:00
parent 23b8183417
commit 280e7638bb
2 changed files with 29 additions and 8 deletions

View File

@ -2,7 +2,7 @@
Name: icu
Version: 63.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: International Components for Unicode
License: MIT and UCD and Public Domain
@ -187,6 +187,9 @@ LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:$LD_LIBRARY_PATH bin/uconv -l
%changelog
* Wed Feb 20 2019 Eike Rathke <erack@redhat.com> - 63.1-3-UNBUILT
- Refresh ICU-20246 patch from maint/maint-63
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 63.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

View File

@ -1,8 +1,9 @@
From 53d8c8f3d181d87a6aa925b449b51c4a2c922a51 Mon Sep 17 00:00:00 2001
From 6cbd62e59e30f73b444be89ea71fd74275ac53a4 Mon Sep 17 00:00:00 2001
From: Shane Carr <shane@unicode.org>
Date: Mon, 29 Oct 2018 23:52:44 -0700
Subject: [PATCH] ICU-20246 Fixing another integer overflow in number parsing.
(cherry picked from commit 53d8c8f3d181d87a6aa925b449b51c4a2c922a51)
---
icu4c/source/i18n/fmtable.cpp | 2 +-
icu4c/source/i18n/number_decimalquantity.cpp | 5 ++++-
@ -13,11 +14,9 @@ Subject: [PATCH] ICU-20246 Fixing another integer overflow in number parsing.
6 files changed, 31 insertions(+), 4 deletions(-)
erAck:
* taken from https://github.com/unicode-org/icu/commits/maint/maint-63
https://github.com/unicode-org/icu/commit/6cbd62e59e30f73b444be89ea71fd74275ac53a4.patch
* obviously removed the icu4j *.java patch parts
* stripped the icu4c/source/test/intltest/numfmtst.cpp part because it
added code to a test that does not exist yet in ICU 62.1
* TODO: when upgrading to ICU 63.1 add that back in from
https://github.com/unicode-org/icu/commit/53d8c8f3d181d87a6aa925b449b51c4a2c922a51.patch
diff --git a/icu4c/source/i18n/fmtable.cpp b/icu4c/source/i18n/fmtable.cpp
index 45c7024fc29..8601d95f4a6 100644
@ -33,10 +32,10 @@ index 45c7024fc29..8601d95f4a6 100644
} else {
fDecimalStr->appendInvariantChars(fDecimalQuantity->toScientificString(), status);
diff --git a/icu4c/source/i18n/number_decimalquantity.cpp b/icu4c/source/i18n/number_decimalquantity.cpp
index 47b930a564b..d5dd7ae694c 100644
index 2c4182b1c6e..f6f2b20fab0 100644
--- a/icu4c/source/i18n/number_decimalquantity.cpp
+++ b/icu4c/source/i18n/number_decimalquantity.cpp
@@ -898,7 +898,10 @@ UnicodeString DecimalQuantity::toScientificString() const {
@@ -820,7 +820,10 @@ UnicodeString DecimalQuantity::toScientificString() const {
}
result.append(u'E');
int32_t _scale = upperPos + scale;
@ -48,3 +47,22 @@ index 47b930a564b..d5dd7ae694c 100644
_scale *= -1;
result.append(u'-');
} else {
diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp
index 34355939113..8d52dc122bf 100644
--- a/icu4c/source/test/intltest/numfmtst.cpp
+++ b/icu4c/source/test/intltest/numfmtst.cpp
@@ -9226,6 +9226,14 @@ void NumberFormatTest::Test20037_ScientificIntegerOverflow() {
assertEquals(u"Should not overflow and should parse only the first exponent",
u"1E-2147483647",
{sp.data(), sp.length(), US_INV});
+
+ // Test edge case overflow of exponent
+ result = Formattable();
+ nf->parse(u".0003e-2147483644", result, status);
+ sp = result.getDecimalNumber(status);
+ assertEquals(u"Should not overflow",
+ u"3E-2147483648",
+ {sp.data(), sp.length(), US_INV});
}
void NumberFormatTest::Test13840_ParseLongStringCrash() {