diff --git a/icu4c/source/common/unorm.cpp b/icu4c/source/common/unorm.cpp index 4cbc317c731..d37f05e5b8c 100644 --- a/icu4c/source/common/unorm.cpp +++ b/icu4c/source/common/unorm.cpp @@ -2220,8 +2220,9 @@ unorm_normalize(const UChar *src, int32_t srcLength, } /* check for overlapping src and destination */ - if( (src>=dest && src<(dest+destCapacity)) || - (srcLength>0 && dest>=src && dest<(src+srcLength)) + if( dest!=NULL && + ((src>=dest && src<(dest+destCapacity)) || + (srcLength>0 && dest>=src && dest<(src+srcLength))) ) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; diff --git a/icu4c/source/common/ustring.c b/icu4c/source/common/ustring.c index 350e8c4991f..c65a01ba812 100644 --- a/icu4c/source/common/ustring.c +++ b/icu4c/source/common/ustring.c @@ -603,8 +603,9 @@ u_strCaseMap(UChar *dest, int32_t destCapacity, } /* check for overlapping source and destination */ - if( (src>=dest && src<(dest+destCapacity)) || - (dest>=src && dest<(src+srcLength)) + if( dest!=NULL && + ((src>=dest && src<(dest+destCapacity)) || + (dest>=src && dest<(src+srcLength))) ) { /* overlap: provide a temporary destination buffer and later copy the result */ if(destCapacity<=(sizeof(buffer)/U_SIZEOF_UCHAR)) {