summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2012-12-19 17:35:31 +0000
committerNoel Power <noel.power@suse.com>2012-12-19 17:40:02 +0000
commit8b9b779e9fc1de7186217b7be75ef02bb66e2da9 (patch)
tree86ec05b30620b6266d3b13643c8f58a0655755e2
parent551cd207621be5922c528d32a6b349bcd8b10925 (diff)
fix crash for fdo#58306 when appending to OUStringBuffer initialised with ""
don't call rtl_uString_newFromLiteral when literal has zero length as that cheats and doesn't assign a buffer. what we really want to do is assign a buffer with initial capacity ( but no content ) Change-Id: I9d642c453dee747aca6365abb15408c05f86bb52
-rw-r--r--sal/inc/rtl/ustrbuf.hxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 98f1fc5ee911..b6ddb66a9562 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -183,7 +183,7 @@ public:
, nCapacity( internal::ConstCharArrayDetector< T, void >::size - 1 + 16 )
{
assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
- rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1, 16 );
+ ( internal::ConstCharArrayDetector< T >::size - 1 ) ? rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1, 16 ) : rtl_uString_new_WithLength( &pData, 16 );
#ifdef RTL_STRING_UNITTEST
rtl_string_unittest_const_literal = true;
#endif