Skip to content

Commit aa17de1

Browse files
committed
ICU-23263 Support shared/static data library that uses a pointer based table of contents
1 parent 275b369 commit aa17de1

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

icu4c/source/common/ucnv_io.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,15 @@ static void U_CALLCONV initAliasData(UErrorCode &errCode) {
249249

250250
sectionSizes = static_cast<const uint32_t*>(udata_getMemory(data));
251251
int32_t dataLength = udata_getLength(data); // This is the length minus the UDataInfo size
252-
if (dataLength <= int32_t(sizeof(sectionSizes[0]))) {
252+
UBool isDataLengthKnown = dataLength >= 0; // Only false when using a pointer table of contents (not files nor a common data archive)
253+
if (isDataLengthKnown && dataLength <= int32_t(sizeof(sectionSizes[0]))) {
253254
// We don't even have a TOC!
254255
goto invalidFormat;
255256
}
256257
table = reinterpret_cast<const uint16_t*>(sectionSizes);
257258
tableStart = sectionSizes[0];
258259
sizeOfTOC = int32_t((tableStart + 1) * sizeof(sectionSizes[0]));
259-
if (tableStart < minTocLength || dataLength <= sizeOfTOC) {
260+
if (tableStart < minTocLength || (isDataLengthKnown && dataLength <= sizeOfTOC)) {
260261
// We don't have a whole TOC!
261262
goto invalidFormat;
262263
}
@@ -279,7 +280,7 @@ static void U_CALLCONV initAliasData(UErrorCode &errCode) {
279280
for (uint32_t section = 1; section <= tableStart; section++) {
280281
sizeOfData += sectionSizes[section] * sizeof(table[0]);
281282
}
282-
if (dataLength < sizeOfData) {
283+
if (isDataLengthKnown && dataLength < sizeOfData) {
283284
// Truncated file!
284285
goto invalidFormat;
285286
}

icu4c/source/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7013,7 +7013,7 @@ case "${host}" in
70137013
# We're using gcc, and the simple -a gcc command line works for genccode
70147014
GENCCODE_ASSEMBLY="-a gcc"
70157015
fi ;;
7016-
i*86-*-solaris*)
7016+
*86*-solaris*)
70177017
if test "$GCC" = yes; then
70187018
# When using gcc, look if we're also using GNU as.
70197019
# When using GNU as, the simple -a gcc command line works for genccode.

icu4c/source/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ case "${host}" in
618618
# We're using gcc, and the simple -a gcc command line works for genccode
619619
GENCCODE_ASSEMBLY="-a gcc"
620620
fi ;;
621-
i*86-*-solaris*)
621+
*86*-solaris*)
622622
if test "$GCC" = yes; then
623623
# When using gcc, look if we're also using GNU as.
624624
# When using GNU as, the simple -a gcc command line works for genccode.

0 commit comments

Comments
 (0)