[Libreoffice-commits] .: sal/inc sal/rtl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 18 09:44:28 PST 2012


 sal/inc/rtl/string.h       |    2 ++
 sal/inc/rtl/ustring.h      |    5 +++--
 sal/rtl/source/strtmpl.cxx |    4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 09123760860f99756d37b70557d83f707fda6b17
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Dec 18 17:43:56 2012 +0000

    fdo#58473 - fix transliteration crasher caused by writing const string.

diff --git a/sal/inc/rtl/string.h b/sal/inc/rtl/string.h
index bfeecf7..26fa5c7 100644
--- a/sal/inc/rtl/string.h
+++ b/sal/inc/rtl/string.h
@@ -821,6 +821,8 @@ SAL_DLLPUBLIC void SAL_CALL rtl_string_new( rtl_String ** newStr ) SAL_THROW_EXT
     The reference count of the new string will be 1. The length of the string
     will be nLen. This function does not handle out-of-memory conditions.
 
+    For nLen < 0 or failed allocation this method returns NULL.
+
     The characters of the capacity are not cleared, and the length is set to
     nLen, unlike the similar method of rtl_String_new_WithLength which
     zeros out the buffer, and sets the length to 0. So should be somewhat
diff --git a/sal/inc/rtl/ustring.h b/sal/inc/rtl/ustring.h
index fe2f2f4..1ff75bd 100644
--- a/sal/inc/rtl/ustring.h
+++ b/sal/inc/rtl/ustring.h
@@ -1152,8 +1152,9 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uString_new(
 /** Allocate a new string containing space for a given number of characters.
 
     The reference count of the new string will be 1. The length of the string
-    will be nLen. This function throws std::bad_alloc on out-of-memory
-    conditions.
+    will be nLen. This function does not handle out-of-memory conditions.
+
+    For nLen < 0 or failed allocation this method returns NULL.
 
     The characters of the capacity are not cleared, and the length is set to
     nLen, unlike the similar method of rtl_uString_new_WithLength which
diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx
index f715a58..cdb4f11 100644
--- a/sal/rtl/source/strtmpl.cxx
+++ b/sal/rtl/source/strtmpl.cxx
@@ -1069,8 +1069,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( new )( IMPL_RTL_STRINGDATA** ppThis )
 IMPL_RTL_STRINGDATA* SAL_CALL IMPL_RTL_STRINGNAME( alloc )( sal_Int32 nLen )
     SAL_THROW_EXTERN_C()
 {
-    if ( nLen <= 0 )
-        return (IMPL_RTL_STRINGDATA*) (&IMPL_RTL_EMPTYSTRING);
+    if ( nLen < 0 )
+        return NULL;
     else
         return IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
 }


More information about the Libreoffice-commits mailing list