mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-1109 fix check for overlapping src/dest
X-SVN-Rev: 5886
This commit is contained in:
parent
6b39c524cf
commit
661cd1be03
2 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue