Browse Source

Merge pull request #13206 from nxhack/icu_67_1

icu: update to 67.1
lilik-openwrt-22.03
Rosen Penev 4 years ago
committed by GitHub
parent
commit
4ce0c68f9f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 160 deletions
  1. +2
    -2
      libs/icu/Makefile
  2. +0
    -40
      libs/icu/patches/010-ICU-20877-i18n-Don-t-use-C-11-math.patch
  3. +0
    -118
      libs/icu/patches/020-ICU-20958_CVE-2020-10531.patch

+ 2
- 2
libs/icu/Makefile View File

@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icu4c
MAJOR_VERSION:=66
MAJOR_VERSION:=67
MINOR_VERSION:=1
PKG_VERSION:=$(MAJOR_VERSION).$(MINOR_VERSION)
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(MAJOR_VERSION)_$(MINOR_VERSION)-src.tgz
PKG_SOURCE_URL:=https://github.com/unicode-org/icu/releases/download/release-$(MAJOR_VERSION)-$(MINOR_VERSION)
PKG_HASH:=52a3f2209ab95559c1cf0a14f24338001f389615bf00e2585ef3dbc43ecf0a2e
PKG_HASH:=94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc
PKG_LICENSE:=ICU
PKG_LICENSE_FILES:=LICENSE


+ 0
- 40
libs/icu/patches/010-ICU-20877-i18n-Don-t-use-C-11-math.patch View File

@ -1,40 +0,0 @@
From 8fda72f6d8e442c5382f21cdd884e2c962bb53bd Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Wed, 11 Dec 2019 13:25:32 -0800
Subject: [PATCH] ICU-20877 i18n: Don't use C++11 math
It's not available with some libc implementations. Specifically,
BIONIC and uClibc-ng. uprv_ variants are available.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
i18n/decimfmt.cpp | 2 +-
i18n/number_decimalquantity.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/i18n/decimfmt.cpp b/i18n/decimfmt.cpp
index 4015250e273..0cbaca7e099 100644
--- a/i18n/decimfmt.cpp
+++ b/i18n/decimfmt.cpp
@@ -1801,7 +1801,7 @@ bool DecimalFormat::fastFormatDouble(double input, UnicodeString& output) const
return false;
}
if (std::isnan(input)
- || std::trunc(input) != input
+ || uprv_trunc(input) != input
|| input <= INT32_MIN
|| input > INT32_MAX) {
return false;
diff --git a/i18n/number_decimalquantity.cpp b/i18n/number_decimalquantity.cpp
index abbc23de032..778feb141b4 100644
--- a/i18n/number_decimalquantity.cpp
+++ b/i18n/number_decimalquantity.cpp
@@ -452,7 +452,7 @@ void DecimalQuantity::_setToDoubleFast(double n) {
for (; i <= -22; i += 22) n /= 1e22;
n /= DOUBLE_MULTIPLIERS[-i];
}
- auto result = static_cast<int64_t>(std::round(n));
+ auto result = static_cast<int64_t>(uprv_round(n));
if (result != 0) {
_setToLong(result);
scale -= fracLength;

+ 0
- 118
libs/icu/patches/020-ICU-20958_CVE-2020-10531.patch View File

@ -1,118 +0,0 @@
From 1d824ede675782fcf9367e4bbcba1d998cdc33f1 Mon Sep 17 00:00:00 2001
From: Frank Tang <ftang@chromium.org>
Date: Sat, 1 Feb 2020 02:39:04 +0000
Subject: [PATCH] ICU-20958 Prevent SEGV_MAPERR in append
See #971
---
icu4c/source/common/unistr.cpp | 6 ++-
icu4c/source/test/intltest/ustrtest.cpp | 62 +++++++++++++++++++++++++
icu4c/source/test/intltest/ustrtest.h | 1 +
3 files changed, 68 insertions(+), 1 deletion(-)
diff --git a/icu4c/source/common/unistr.cpp b/icu4c/source/common/unistr.cpp
index 901bb3358ba..077b4d6ef20 100644
--- a/common/unistr.cpp
+++ b/common/unistr.cpp
@@ -1563,7 +1563,11 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
}
int32_t oldLength = length();
- int32_t newLength = oldLength + srcLength;
+ int32_t newLength;
+ if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {
+ setToBogus();
+ return *this;
+ }
// Check for append onto ourself
const UChar* oldArray = getArrayStart();
diff --git a/icu4c/source/test/intltest/ustrtest.cpp b/icu4c/source/test/intltest/ustrtest.cpp
index b6515ea813c..ad38bdf53a3 100644
--- a/test/intltest/ustrtest.cpp
+++ b/test/intltest/ustrtest.cpp
@@ -67,6 +67,7 @@ void UnicodeStringTest::runIndexedTest( int32_t index, UBool exec, const char* &
TESTCASE_AUTO(TestWCharPointers);
TESTCASE_AUTO(TestNullPointers);
TESTCASE_AUTO(TestUnicodeStringInsertAppendToSelf);
+ TESTCASE_AUTO(TestLargeAppend);
TESTCASE_AUTO_END;
}
@@ -2310,3 +2311,64 @@ void UnicodeStringTest::TestUnicodeStringInsertAppendToSelf() {
str.insert(2, sub);
assertEquals("", u"abbcdcde", str);
}
+
+void UnicodeStringTest::TestLargeAppend() {
+ if(quick) return;
+
+ IcuTestErrorCode status(*this, "TestLargeAppend");
+ // Make a large UnicodeString
+ int32_t len = 0xAFFFFFF;
+ UnicodeString str;
+ char16_t *buf = str.getBuffer(len);
+ // A fast way to set buffer to valid Unicode.
+ // 4E4E is a valid unicode character
+ uprv_memset(buf, 0x4e, len * 2);
+ str.releaseBuffer(len);
+ UnicodeString dest;
+ // Append it 16 times
+ // 0xAFFFFFF times 16 is 0xA4FFFFF1,
+ // which is greater than INT32_MAX, which is 0x7FFFFFFF.
+ int64_t total = 0;
+ for (int32_t i = 0; i < 16; i++) {
+ dest.append(str);
+ total += len;
+ if (total <= INT32_MAX) {
+ assertFalse("dest is not bogus", dest.isBogus());
+ } else {
+ assertTrue("dest should be bogus", dest.isBogus());
+ }
+ }
+ dest.remove();
+ total = 0;
+ for (int32_t i = 0; i < 16; i++) {
+ dest.append(str);
+ total += len;
+ if (total + len <= INT32_MAX) {
+ assertFalse("dest is not bogus", dest.isBogus());
+ } else if (total <= INT32_MAX) {
+ // Check that a string of exactly the maximum size works
+ UnicodeString str2;
+ int32_t remain = INT32_MAX - total;
+ char16_t *buf2 = str2.getBuffer(remain);
+ if (buf2 == nullptr) {
+ // if somehow memory allocation fail, return the test
+ return;
+ }
+ uprv_memset(buf2, 0x4e, remain * 2);
+ str2.releaseBuffer(remain);
+ dest.append(str2);
+ total += remain;
+ assertEquals("When a string of exactly the maximum size works", (int64_t)INT32_MAX, total);
+ assertEquals("When a string of exactly the maximum size works", INT32_MAX, dest.length());
+ assertFalse("dest is not bogus", dest.isBogus());
+
+ // Check that a string size+1 goes bogus
+ str2.truncate(1);
+ dest.append(str2);
+ total++;
+ assertTrue("dest should be bogus", dest.isBogus());
+ } else {
+ assertTrue("dest should be bogus", dest.isBogus());
+ }
+ }
+}
diff --git a/icu4c/source/test/intltest/ustrtest.h b/icu4c/source/test/intltest/ustrtest.h
index 218befdcc68..4a356a92c7a 100644
--- a/test/intltest/ustrtest.h
+++ b/test/intltest/ustrtest.h
@@ -97,6 +97,7 @@ class UnicodeStringTest: public IntlTest {
void TestWCharPointers();
void TestNullPointers();
void TestUnicodeStringInsertAppendToSelf();
+ void TestLargeAppend();
};
#endif

Loading…
Cancel
Save