comphelper/source/misc/string.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit 72c42be077908901e8a967d3a543296ca92ce51f Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon May 30 22:55:11 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Mon May 30 23:36:15 2022 +0200 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 <sberg...@redhat.com> 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());