summaryrefslogtreecommitdiff
path: root/sal/rtl/ustring.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sal/rtl/ustring.cxx')
-rw-r--r--sal/rtl/ustring.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index 85ac84a97538..7940d5af1240 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -612,7 +612,13 @@ void rtl_uString_newConcatAsciiL(
assert(right != nullptr);
assert(rightLength >= 0);
if (left->length > std::numeric_limits<sal_Int32>::max() - rightLength) {
+#if !defined(__COVERITY__)
throw std::length_error("rtl_uString_newConcatAsciiL");
+#else
+ //coverity doesn't report std::bad_alloc as an unhandled exception when
+ //potentially thrown from destructors but does report std::length_error
+ throw std::bad_alloc();
+#endif
}
sal_Int32 n = left->length + rightLength;
rtl_uString_assign(newString, left);
@@ -634,7 +640,13 @@ void rtl_uString_newConcatUtf16L(
assert(right != nullptr);
assert(rightLength >= 0);
if (left->length > std::numeric_limits<sal_Int32>::max() - rightLength) {
+#if !defined(__COVERITY__)
throw std::length_error("rtl_uString_newConcatUtf16L");
+#else
+ //coverity doesn't report std::bad_alloc as an unhandled exception when
+ //potentially thrown from destructors but does report std::length_error
+ throw std::bad_alloc();
+#endif
}
sal_Int32 n = left->length + rightLength;
rtl_uString_assign(newString, left);