summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-05-30 22:55:11 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-05-30 23:36:15 +0200
commit72c42be077908901e8a967d3a543296ca92ce51f (patch)
tree4251fe27bad6fdd82d0128ae8e3700da52046697 /comphelper
parent26143512e590892e2371253f48216c8867229b5e (diff)
Use o3tl::make_unsigned, nCount is already asserted non-negative here
Change-Id: I7213e9f2e3a5a4a785d44932900496a791b1964a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135146 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/string.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 979964f17552..d35471f5c504 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -25,6 +25,7 @@
#include <vector>
#include <algorithm>
+#include <o3tl/safeint.hxx>
#include <rtl/character.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
@@ -645,7 +646,7 @@ void replaceAt(OUStringBuffer& rIn, sal_Int32 nIndex, sal_Int32 nCount, std::u16
}
sal_Int32 nNewLength = nOldLength + newStr.size() - nCount;
- if (static_cast<sal_Int32>(newStr.size()) > nCount)
+ if (newStr.size() > o3tl::make_unsigned(nCount))
rIn.ensureCapacity(nOldLength + newStr.size() - nCount);
sal_Unicode* pStr = const_cast<sal_Unicode*>(rIn.getStr());