ICU-8091 guard against pinIndices() reducing length to 0 or 1
X-SVN-Rev: 28982
This commit is contained in:
parent
04000e60ff
commit
b674f702e1
@ -1377,15 +1377,16 @@ UBool UnicodeString::hasMetaData() const {
|
||||
}
|
||||
|
||||
UnicodeString&
|
||||
UnicodeString::doReverse(int32_t start,
|
||||
int32_t length)
|
||||
{
|
||||
if(this->length() <= 1 || !cloneArrayIfNeeded()) {
|
||||
UnicodeString::doReverse(int32_t start, int32_t length) {
|
||||
if(length <= 1 || !cloneArrayIfNeeded()) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
// pin the indices to legal values
|
||||
pinIndices(start, length);
|
||||
if(length <= 1) { // pinIndices() might have shrunk the length
|
||||
return *this;
|
||||
}
|
||||
|
||||
UChar *left = getArrayStart() + start;
|
||||
UChar *right = left + length - 1; // -1 for inclusive boundary (length>=2)
|
||||
|
Loading…
Reference in New Issue
Block a user