| diff --git a/source/common/ucase.cpp b/source/common/ucase.cpp |
| index 706d7289..6b22f9e3 100644 |
| --- a/source/common/ucase.cpp |
| +++ b/source/common/ucase.cpp |
| @@ -961,6 +961,7 @@ 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)) { |
| /* |
| @@ -1059,6 +1060,7 @@ toUpperOrTitle(UChar32 c, |
| |
| 0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE |
| */ |
| + *pString=nullptr; |
| return 0; /* remove the dot (continue without output) */ |
| } else { |
| /* no known conditional special case mapping, use a normal mapping */ |
| diff --git a/source/common/ucasemap.cpp b/source/common/ucasemap.cpp |
| index 391140d6..1523cb6d 100644 |
| --- a/source/common/ucasemap.cpp |
| +++ b/source/common/ucasemap.cpp |
| @@ -177,18 +177,22 @@ appendResult(uint8_t *dest, int32_t destIndex, int32_t destCapacity, |
| } else { |
| if(result<=UCASE_MAX_STRING_LENGTH) { |
| // string: "result" is the UTF-16 length |
| - errorCode=U_ZERO_ERROR; |
| - if(destIndex<destCapacity) { |
| - u_strToUTF8((char *)(dest+destIndex), destCapacity-destIndex, &length, |
| - s, result, &errorCode); |
| + if(result==0) { |
| + length=0; |
| } else { |
| - u_strToUTF8(NULL, 0, &length, s, result, &errorCode); |
| - } |
| - if(U_FAILURE(errorCode) && errorCode != U_BUFFER_OVERFLOW_ERROR) { |
| - return -1; |
| - } |
| - if(length>(INT32_MAX-destIndex)) { |
| - return -1; // integer overflow |
| + errorCode=U_ZERO_ERROR; |
| + if(destIndex<destCapacity) { |
| + u_strToUTF8((char *)(dest+destIndex), destCapacity-destIndex, &length, |
| + s, result, &errorCode); |
| + } else { |
| + u_strToUTF8(NULL, 0, &length, s, result, &errorCode); |
| + } |
| + if(U_FAILURE(errorCode) && errorCode != U_BUFFER_OVERFLOW_ERROR) { |
| + return -1; |
| + } |
| + if(length>(INT32_MAX-destIndex)) { |
| + return -1; // integer overflow |
| + } |
| } |
| if(edits!=NULL) { |
| edits->addReplace(cpLength, length); |