ICU-1109 fix check for overlapping src/dest

X-SVN-Rev: 5886
This commit is contained in:
Markus Scherer 2001-09-22 00:56:23 +00:00
parent 6b39c524cf
commit 661cd1be03
2 changed files with 6 additions and 4 deletions
icu4c/source/common

View file

@ -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;

View file

@ -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)) {