Skip to content

Commit

Permalink
ICU-21041 Fix fuzzer memory read error.
Browse files Browse the repository at this point in the history
See #1622
  • Loading branch information
FrankYFTang committed Mar 10, 2021
1 parent 6cdfe2d commit 63b9a8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions .cpyskip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ KEYS
*.dat
*.DS_Store
*.doc
*.fuzz
*.gif
*.gz
*.ico
Expand Down
6 changes: 6 additions & 0 deletions icu4c/source/i18n/collationdatabuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,18 @@ DataBuilderCollationIterator::getDataCE32(UChar32 c) const {

uint32_t
DataBuilderCollationIterator::getCE32FromBuilderData(uint32_t ce32, UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return 0; }
U_ASSERT(Collation::hasCE32Tag(ce32, Collation::BUILDER_DATA_TAG));
if((ce32 & CollationDataBuilder::IS_BUILDER_JAMO_CE32) != 0) {
UChar32 jamo = Collation::indexFromCE32(ce32);
return utrie2_get32(builder.trie, jamo);
} else {
ConditionalCE32 *cond = builder.getConditionalCE32ForCE32(ce32);
if (cond == nullptr) {
errorCode = U_INTERNAL_PROGRAM_ERROR;
// TODO: ICU-21531 figure out why this happens.
return 0;
}
if(cond->builtCE32 == Collation::NO_CE32) {
// Build the context-sensitive mappings into their runtime form and cache the result.
cond->builtCE32 = builder.buildContext(cond, errorCode);
Expand Down
Binary file not shown.

0 comments on commit 63b9a8a

Please sign in to comment.