summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-08 08:58:04 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-06-08 08:58:04 +0200
commit93d6a7ca515909c657224cb2f8d5397c376b8017 (patch)
tree9532b2d26695b8599ba69ace61412aafc2954b3d /sal
parent0e2a6e8ea20d74436b544104969a0fdca0003b59 (diff)
Avoid -fsanitize=signed-integer-overflow
...in recently introduced basic/qa/basic_coverage/test_string_overflow_safe.vb in CppunitTest_basic_macros Change-Id: Ib33272afa26e90729617cb86ae979c0b35b45f62
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/strtmpl.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 3ab7698877ad..60712731e186 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1503,6 +1503,11 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newConcat )( IMPL_RTL_STRINGDATA** ppThis,
*ppThis = pRight;
IMPL_RTL_ACQUIRE( pRight );
}
+ else if (pLeft->length
+ > std::numeric_limits<sal_Int32>::max() - pRight->length)
+ {
+ *ppThis = nullptr;
+ }
else
{
IMPL_RTL_STRINGDATA* pTempStr = IMPL_RTL_STRINGNAME( ImplAlloc )( pLeft->length + pRight->length );