Skip to content

Commit f324918

Browse files
committed
ICU: Backport 79.1 commit that fixes non-assembly datafile
1 parent 01c5e56 commit f324918

5 files changed

Lines changed: 64 additions & 1 deletion

File tree

emscripten/2_build_toolchain.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ if [ ! -f .patches-applied ]; then
3636
# (see https://groups.google.com/forum/#!topic/emscripten-discuss/YM3jC_qQoPk)
3737
perl -pi -e 's/HAVE_ARC4RANDOM\)/NO_ARC4RANDOM\)/' $EXPAT_DIR/ConfigureChecks.cmake
3838

39+
# Fix ICU (Remove when 79.1 is released)
40+
(cd $ICU_DIR
41+
patch -Np2 < $SCRIPT_DIR/../shared/extra/icu-fix-data.patch
42+
)
43+
3944
if [ "$USE_WASM_SIMD" == "1" ]; then
4045
(cd $PIXMAN_DIR
41-
patch -Np2 < ../pixman-wasm.patch
46+
patch -Np2 < $SCRIPT_DIR/pixman-wasm.patch
4247
)
4348
fi
4449

ios/2_build_toolchain.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ if [ ! -f .patches-applied ]; then
2222

2323
patches_common
2424

25+
# Fix ICU (Remove when 79.1 is released)
26+
(cd $ICU_DIR
27+
patch -Np2 < $SCRIPT_DIR/../shared/extra/icu-fix-data.patch
28+
)
29+
2530
touch .patches-applied
2631
fi
2732

macos/2_build_toolchain.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ if [ ! -f .patches-applied ]; then
2222

2323
patches_common
2424

25+
# Fix ICU (Remove when 79.1 is released)
26+
(cd $ICU_DIR
27+
patch -Np2 < $SCRIPT_DIR/../shared/extra/icu-fix-data.patch
28+
)
29+
2530
touch .patches-applied
2631
fi
2732

shared/extra/icu-fix-data.patch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From aa17de1994d188560d99d07c37bf333416483899 Mon Sep 17 00:00:00 2001
2+
From: George Rhoten <grhoten@users.noreply.github.com>
3+
Date: Tue, 18 Nov 2025 15:47:24 -0800
4+
Subject: [PATCH] ICU-23263 Support shared/static data library that uses a
5+
pointer based table of contents
6+
7+
---
8+
icu4c/source/common/ucnv_io.cpp | 7 ++++---
9+
icu4c/source/configure | 2 +-
10+
icu4c/source/configure.ac | 2 +-
11+
3 files changed, 6 insertions(+), 5 deletions(-)
12+
13+
diff --git a/icu4c/source/common/ucnv_io.cpp b/icu4c/source/common/ucnv_io.cpp
14+
index 46a26f821fd8..66813f5a0372 100644
15+
--- a/icu4c/source/common/ucnv_io.cpp
16+
+++ b/icu4c/source/common/ucnv_io.cpp
17+
@@ -249,14 +249,15 @@ static void U_CALLCONV initAliasData(UErrorCode &errCode) {
18+
19+
sectionSizes = static_cast<const uint32_t*>(udata_getMemory(data));
20+
int32_t dataLength = udata_getLength(data); // This is the length minus the UDataInfo size
21+
- if (dataLength <= int32_t(sizeof(sectionSizes[0]))) {
22+
+ UBool isDataLengthKnown = dataLength >= 0; // Only false when using a pointer table of contents (not files nor a common data archive)
23+
+ if (isDataLengthKnown && dataLength <= int32_t(sizeof(sectionSizes[0]))) {
24+
// We don't even have a TOC!
25+
goto invalidFormat;
26+
}
27+
table = reinterpret_cast<const uint16_t*>(sectionSizes);
28+
tableStart = sectionSizes[0];
29+
sizeOfTOC = int32_t((tableStart + 1) * sizeof(sectionSizes[0]));
30+
- if (tableStart < minTocLength || dataLength <= sizeOfTOC) {
31+
+ if (tableStart < minTocLength || (isDataLengthKnown && dataLength <= sizeOfTOC)) {
32+
// We don't have a whole TOC!
33+
goto invalidFormat;
34+
}
35+
@@ -279,7 +280,7 @@ static void U_CALLCONV initAliasData(UErrorCode &errCode) {
36+
for (uint32_t section = 1; section <= tableStart; section++) {
37+
sizeOfData += sectionSizes[section] * sizeof(table[0]);
38+
}
39+
- if (dataLength < sizeOfData) {
40+
+ if (isDataLengthKnown && dataLength < sizeOfData) {
41+
// Truncated file!
42+
goto invalidFormat;
43+
}

tvos/2_build_toolchain.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ if [ ! -f .patches-applied ]; then
2222

2323
patches_common
2424

25+
# Fix ICU (Remove when 79.1 is released)
26+
(cd $ICU_DIR
27+
patch -Np2 < $SCRIPT_DIR/../shared/extra/icu-fix-data.patch
28+
)
29+
2530
touch .patches-applied
2631
fi
2732

0 commit comments

Comments
 (0)