blob: ddd0d1a3700c9bc02e1e81d137768f9d5e3fc5b0 [file] [log] [blame]
diff --git a/source/common/unistr.cpp b/source/common/unistr.cpp
index 901bb335..077b4d6e 100644
--- a/source/common/unistr.cpp
+++ b/source/common/unistr.cpp
@@ -1563,7 +1563,11 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
}
int32_t oldLength = length();
- int32_t newLength = oldLength + srcLength;
+ int32_t newLength;
+ if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {
+ setToBogus();
+ return *this;
+ }
// Check for append onto ourself
const UChar* oldArray = getArrayStart();