Skip to content

Commit

Permalink
ICU-21820 ucase_toFullXyz() reset output pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
markusicu committed Nov 5, 2021
1 parent fd5a346 commit 51016c1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions icu4c/source/common/ucase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,8 @@ ucase_toFullLower(UChar32 c,
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
UChar32 result=c;
// Reset the output pointer in case it was uninitialized.
*pString=nullptr;
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_IS_UPPER_OR_TITLE(props)) {
Expand Down Expand Up @@ -1148,7 +1150,6 @@ ucase_toFullLower(UChar32 c,
0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE
0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE
*/
*pString=nullptr;
return 0; /* remove the dot (continue without output) */
} else if(loc==UCASE_LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(iter, context)) {
/*
Expand Down Expand Up @@ -1215,6 +1216,8 @@ toUpperOrTitle(UChar32 c,
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
UChar32 result=c;
// Reset the output pointer in case it was uninitialized.
*pString=nullptr;
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_GET_TYPE(props)==UCASE_LOWER) {
Expand Down Expand Up @@ -1252,7 +1255,6 @@ toUpperOrTitle(UChar32 c,
0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE
*/
*pString=nullptr;
return 0; /* remove the dot (continue without output) */
} else if(c==0x0587) {
// See ICU-13416:
Expand Down Expand Up @@ -1449,6 +1451,8 @@ ucase_toFullFolding(UChar32 c,
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
UChar32 result=c;
// Reset the output pointer in case it was uninitialized.
*pString=nullptr;
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_IS_UPPER_OR_TITLE(props)) {
Expand Down

0 comments on commit 51016c1

Please sign in to comment.