summaryrefslogtreecommitdiff
path: root/libicuuc/libicu/unistr.cpp.patch
blob: 485f94c09e40b5178df2d91beb507ca9ae63a441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--- libicu/uc/unistr.cpp	2019-12-23 14:38:39.792890424 +0300
+++ libicu/unistr.cpp	2020-04-07 21:15:55.107326955 +0300
@@ -1563,7 +1563,11 @@ UnicodeString::doAppend(const UChar *src
   }
 
   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();