sal/rtl/strtmpl.cxx | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit 93d6a7ca515909c657224cb2f8d5397c376b8017
Author: Stephan Bergmann <[email protected]>
Date: Thu Jun 8 08:58:04 2017 +0200
Avoid -fsanitize=signed-integer-overflow
...in recently introduced
basic/qa/basic_coverage/test_string_overflow_safe.vb
in CppunitTest_basic_macros
Change-Id: Ib33272afa26e90729617cb86ae979c0b35b45f62
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 );
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits