icu: upgrade 66.1 -> 67.1

- 0001-icu-Added-armeb-support.patch - rebased
- 0001-Fix-big-endian-build.patch - removed, already included in new version
- CVE-2020-10531.patch - removed, already included in new version
- icu-pkgdata-large-cmd.patch - removed, implemented correct size

(From OE-Core rev: 62feb846853bcc8982258a224a3e84090d6559a2)

Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Andrej Valek
2020-05-01 11:15:54 +02:00
committed by Richard Purdie
parent d692ae9b7b
commit a52a755110
5 changed files with 5 additions and 214 deletions

View File

@@ -1,28 +0,0 @@
From 9be0b489a94b57419202c552022f25cb95bfac51 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 17 Apr 2019 16:41:58 +0200
Subject: [PATCH] Fix big-endian build
Bug-report: https://unicode-org.atlassian.net/browse/ICU-20533
Patch taken from: https://bugs.gentoo.org/682170
it is applied upstream and will be in version 67+
Upstream-Status: Backport [https://github.com/unicode-org/icu/commit/4a3a457b38cd828b7b3fa4fdbc6e2504a57275e9]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
data/Makefile.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -148,7 +148,8 @@ ICUDATA_ARCHIVE = $(firstword $(wildcard
# and convert it to the current type.
ifneq ($(ICUDATA_ARCHIVE),)
ICUDATA_SOURCE_ARCHIVE = $(OUTDIR)/$(ICUDATA_PLATFORM_NAME).dat
-$(ICUDATA_SOURCE_ARCHIVE): $(ICUDATA_ARCHIVE) $(OUTDIR)
+$(ICUDATA_SOURCE_ARCHIVE): $(ICUDATA_ARCHIVE)
+ $(MKINSTALLDIRS) $(OUTDIR)
$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(ICUDATA_ARCHIVE) $(ICUDATA_SOURCE_ARCHIVE)
endif
else

View File

@@ -13,10 +13,10 @@ Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/i18n/double-conversion-utils.h b/i18n/double-conversion-utils.h
index 1e44fca..e4f2a8b 100644
index 8c6a0e1..cf89907 100644
--- a/i18n/double-conversion-utils.h
+++ b/i18n/double-conversion-utils.h
@@ -92,7 +92,7 @@ int main(int argc, char** argv) {
@@ -115,7 +115,7 @@ int main(int argc, char** argv) {
//
// If it prints "correct" then the architecture should be here, in the "correct" section.
#if defined(_M_X64) || defined(__x86_64__) || \
@@ -24,7 +24,7 @@ index 1e44fca..e4f2a8b 100644
+ defined(__arm__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
defined(__nios2__) || \
--
2.7.4

View File

@@ -1,128 +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
Upstream-Status: Accepted
CVE: CVE-2020-10531
Reference to upstream patch:
https://github.com/unicode-org/icu/commit/b7d08bc04a4296982fcef8b6b8a354a9e4e7afca
---
common/unistr.cpp | 6 ++-
test/intltest/ustrtest.cpp | 62 +++++++++++++++++++++++++++++++
test/intltest/ustrtest.h | 1 +
3 files changed, 68 insertions(+), 1 deletion(-)
diff --git a/common/unistr.cpp b/common/unistr.cpp
index 901bb33..6ea0915 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/test/intltest/ustrtest.cpp b/test/intltest/ustrtest.cpp
index b6515ea..ad38bdf 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/test/intltest/ustrtest.h b/test/intltest/ustrtest.h
index 218befd..4a356a9 100644
--- a/test/intltest/ustrtest.h
+++ b/test/intltest/ustrtest.h
@@ -97,6 +97,7 @@ public:
void TestWCharPointers();
void TestNullPointers();
void TestUnicodeStringInsertAppendToSelf();
+ void TestLargeAppend();
};
#endif
--
2.17.1

View File

@@ -1,49 +0,0 @@
pkgdata.cpp: use LARGE_BUFFER_MAX_SIZE for cmd
Use LARGE_BUFFER_MAX_SIZE for cmd rather than SMALL_BUFFER_MAX_SIZE,
otherwise there was a Segmentation fault error when the command line is
long, this should be a misplay since other cmd uses
LARGE_BUFFER_MAX_SIZE.
Upstream-Status: Pending
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
tools/pkgdata/pkgdata.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/pkgdata/pkgdata.cpp b/tools/pkgdata/pkgdata.cpp
index 60167dd..506dd32 100644
--- a/tools/pkgdata/pkgdata.cpp
+++ b/tools/pkgdata/pkgdata.cpp
@@ -1084,7 +1084,7 @@ normal_symlink_mode:
static int32_t pkg_installLibrary(const char *installDir, const char *targetDir, UBool noVersion) {
int32_t result = 0;
- char cmd[SMALL_BUFFER_MAX_SIZE];
+ char cmd[LARGE_BUFFER_MAX_SIZE];
sprintf(cmd, "cd %s && %s %s %s%s%s",
targetDir,
@@ -1152,7 +1152,7 @@ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir,
static int32_t pkg_installCommonMode(const char *installDir, const char *fileName) {
int32_t result = 0;
- char cmd[SMALL_BUFFER_MAX_SIZE] = "";
+ char cmd[LARGE_BUFFER_MAX_SIZE] = "";
if (!T_FileStream_file_exists(installDir)) {
UErrorCode status = U_ZERO_ERROR;
@@ -1184,7 +1184,7 @@ static int32_t pkg_installCommonMode(const char *installDir, const char *fileNam
#endif
static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, const char *fileListName) {
int32_t result = 0;
- char cmd[SMALL_BUFFER_MAX_SIZE] = "";
+ char cmd[LARGE_BUFFER_MAX_SIZE] = "";
if (!T_FileStream_file_exists(installDir)) {
UErrorCode status = U_ZERO_ERROR;
--
1.9.1

View File

@@ -22,18 +22,15 @@ DATA_SRC_URI = "https://github.com/unicode-org/icu/releases/download/release-${I
SRC_URI = "${BASE_SRC_URI};name=code \
${DATA_SRC_URI};name=data \
file://filter.json \
file://icu-pkgdata-large-cmd.patch \
file://fix-install-manx.patch \
file://0001-Fix-big-endian-build.patch;apply=no \
file://0001-icu-Added-armeb-support.patch \
file://CVE-2020-10531.patch \
"
SRC_URI_append_class-target = "\
file://0001-Disable-LDFLAGSICUDT-for-Linux.patch \
"
SRC_URI[code.sha256sum] = "52a3f2209ab95559c1cf0a14f24338001f389615bf00e2585ef3dbc43ecf0a2e"
SRC_URI[data.sha256sum] = "8be647f738891d2beb79d48f99077b3499948430eae6f1be112553b15ab0243e"
SRC_URI[code.sha256sum] = "94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc"
SRC_URI[data.sha256sum] = "7c16a59cc8c06128b7ecc1dc4fc056b36b17349312829b17408b9e67b05c4a7e"
UPSTREAM_CHECK_REGEX = "icu4c-(?P<pver>\d+(_\d+)+)-src"
UPSTREAM_CHECK_URI = "https://github.com/unicode-org/icu/releases"
@@ -44,7 +41,6 @@ do_make_icudata_class-target () {
cd ${S}
rm -rf data
cp -a ${WORKDIR}/data .
patch -p1 < ${WORKDIR}/0001-Fix-big-endian-build.patch
AR='${BUILD_AR}' \
CC='${BUILD_CC}' \
CPP='${BUILD_CPP}' \