Kaydet (Commit) d77c1089 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

external/icu: Change flexible array members to be of length 1 instead of 2

...so that -fsanitize=undefined does not report false out-of-bounds accesses;
Clang's isFlexibleArrayMemberExpr (lib/CodeGen/CGExpr.cpp) only treats arrays of
length 0 and 1 as such special flexible cases.

There appears to be no code in icu that depends on those arrays to be of length
2 (e.g., via sizeof), though it does look suspicious that they are deliberately
of length 2 instead of 1.

Change-Id: I85293e769f1d64cb4e60e13f1cd7f88b76e37487
üst aca657b3
--- source/common/rbbidata.h
+++ source/common/rbbidata.h
@@ -113,7 +113,7 @@
/* StatusTable of the set of matching */
/* tags (rule status values) */
int16_t fReserved;
- uint16_t fNextState[2]; /* Next State, indexed by char category. */
+ uint16_t fNextState[1]; /* Next State, indexed by char category. */
/* This array does not have two elements */
/* Array Size is actually fData->fHeader->fCatCount */
/* CAUTION: see RBBITableBuilder::getTableSize() */
--- source/common/ucmndata.h
+++ source/common/ucmndata.h
@@ -50,7 +50,7 @@
typedef struct {
uint32_t count;
- UDataOffsetTOCEntry entry[2]; /* Actual size of array is from count. */
+ UDataOffsetTOCEntry entry[1]; /* Actual size of array is from count. */
} UDataOffsetTOC;
/**
--- source/common/ustring.cpp --- source/common/ustring.cpp
+++ source/common/ustring.cpp +++ source/common/ustring.cpp
@@ -1486,7 +1486,7 @@ @@ -1486,7 +1486,7 @@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment