diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/icu/APKBUILD | 12 | ||||
-rw-r--r-- | system/icu/CVE-2020-10531.patch | 118 | ||||
-rw-r--r-- | system/icu/tests.patch | 41 |
3 files changed, 47 insertions, 124 deletions
diff --git a/system/icu/APKBUILD b/system/icu/APKBUILD index 046698316..1739eeee0 100644 --- a/system/icu/APKBUILD +++ b/system/icu/APKBUILD @@ -1,14 +1,14 @@ # Contributor: Sergey Lukin <sergej.lukin@gmail.com> # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=icu -pkgver=65.1 +pkgver=70.1 # convert x.y.z to x_y_z _ver=$(printf '%s' "$pkgver" | tr . _) pkgrel=1 pkgdesc="International Components for Unicode" -url="http://site.icu-project.org/" +url="https://icu.unicode.org" arch="all" license="ICU" depends="" @@ -17,7 +17,7 @@ makedepends="" subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs" source="https://github.com/unicode-org/icu/releases/download/release-$(printf '%s' "$pkgver" | tr . -)/${pkgname}4c-$_ver-src.tgz icu-60.2-always-use-utf8.patch - CVE-2020-10531.patch + tests.patch " # secfixes: @@ -37,7 +37,7 @@ prepare() { default_prepare update_config_sub - # https://bugs.icu-project.org/trac/ticket/6102 + # https://unicode-org.atlassian.net/browse/ICU-6102 for x in ARFLAGS CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS; do sed -i -e "/^${x} =.*/s:@${x}@::" "config/Makefile.inc.in" done @@ -76,6 +76,6 @@ static() { mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/ } -sha512sums="8f1ef33e1f4abc9a8ee870331c59f01b473d6da1251a19ce403f822f3e3871096f0791855d39c8f20c612fc49cda2c62c06864aa32ddab2dbd186d2b21ce9139 icu4c-65_1-src.tgz +sha512sums="0b26ae7207155cb65a8fdb25f7b2fa4431e74b12bccbed0884a17feaae3c96833d12451064dd152197fd6ea5fd3adfd95594284a463e66c82e0d860f645880c9 icu4c-70_1-src.tgz f86c62422f38f6485c58d4766e629bab69e4b0e00fa910854e40e7db1ace299152eaefa99ae2fbab7465e65d3156cbea7124612defa60680db58ab5c34d6262f icu-60.2-always-use-utf8.patch -2901235a24b1973516e495473188b077eb0486714ac47f702f226a3406176e913672159978b67548a1316284ecc716e06158b05c190ddfa83ad576a7a3539d72 CVE-2020-10531.patch" +9f5796fac698803e18556340322c020caa32308d93b94bda3871ceebc0cecb7fa167dc4548fed4060dab8891f3f7a47d4dd422c708751cada35a36874e255fd6 tests.patch" diff --git a/system/icu/CVE-2020-10531.patch b/system/icu/CVE-2020-10531.patch deleted file mode 100644 index f456b06ec..000000000 --- a/system/icu/CVE-2020-10531.patch +++ /dev/null @@ -1,118 +0,0 @@ -From b7d08bc04a4296982fcef8b6b8a354a9e4e7afca 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 ---- - source/common/unistr.cpp | 6 ++- - source/test/intltest/ustrtest.cpp | 62 +++++++++++++++++++++++++ - source/test/intltest/ustrtest.h | 1 + - 3 files changed, 68 insertions(+), 1 deletion(-) - -diff --git source/common/unistr.cpp source/common/unistr.cpp -index 901bb3358ba..077b4d6ef20 100644 ---- source/common/unistr.cpp -+++ source/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 source/test/intltest/ustrtest.cpp source/test/intltest/ustrtest.cpp -index b6515ea813c..ad38bdf53a3 100644 ---- source/test/intltest/ustrtest.cpp -+++ source/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 source/test/intltest/ustrtest.h source/test/intltest/ustrtest.h -index 218befdcc68..4a356a92c7a 100644 ---- source/test/intltest/ustrtest.h -+++ source/test/intltest/ustrtest.h -@@ -97,6 +97,7 @@ class UnicodeStringTest: public IntlTest { - void TestWCharPointers(); - void TestNullPointers(); - void TestUnicodeStringInsertAppendToSelf(); -+ void TestLargeAppend(); - }; - - #endif diff --git a/system/icu/tests.patch b/system/icu/tests.patch new file mode 100644 index 000000000..499b8ec2e --- /dev/null +++ b/system/icu/tests.patch @@ -0,0 +1,41 @@ +Upstream report: https://unicode-org.atlassian.net/browse/ICU-21793 + +From 1b84ce27b41067e8f913da074917a1f6f9831fb9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= <kapouer@melix.org> +Date: Wed, 3 Nov 2021 02:31:18 +0100 +Subject: [PATCH] ICU-21793 Fix ucptrietest golden diff + +--- + icu4c/source/tools/toolutil/toolutil.cpp | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/icu4c/source/tools/toolutil/toolutil.cpp b/icu4c/source/tools/toolutil/toolutil.cpp +index 1fc68aa69c8..a9dc37377a8 100644 +--- a/tools/toolutil/toolutil.cpp ++++ b/tools/toolutil/toolutil.cpp +@@ -228,18 +228,19 @@ uprv_compareGoldenFiles( + std::ifstream ifs(goldenFilePath, std::ifstream::in); + int32_t pos = 0; + char c; +- while ((c = ifs.get()) != std::char_traits<char>::eof() && pos < bufferLen) { ++ while (ifs.get(c) && pos < bufferLen) { + if (c != buffer[pos]) { + // Files differ at this position +- return pos; ++ break; + } + pos++; + } +- if (pos < bufferLen || c != std::char_traits<char>::eof()) { +- // Files are different lengths +- return pos; ++ if (pos == bufferLen && ifs.eof()) { ++ // Files are same lengths ++ pos = -1; + } +- return -1; ++ ifs.close(); ++ return pos; + } + + /*U_CAPI UDate U_EXPORT2 |