[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source

Eike Rathke erack at redhat.com
Mon Apr 13 12:57:32 PDT 2015


 sc/source/core/tool/interpr1.cxx |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

New commits:
commit fed4bc5e52340262eec408fa348bf633f02823bf
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Apr 13 18:06:46 2015 +0200

    string access out of bounds
    
    Another UniString to OUString conversion fallout.
    
    Change-Id: I5e62b049da3e7f8b5a892ea6aae7110a33564a46
    (cherry picked from commit 9f52efa43b2d65c0b6c92790cc2859e752bf975f)
    Reviewed-on: https://gerrit.libreoffice.org/15286
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d79a138..4ad6f1e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3187,15 +3187,20 @@ void ScInterpreter::ScCode()
 {
 //2do: make it full range unicode?
     OUString aStr = GetString().getString();
-    //"classic" ByteString conversion flags
-    const sal_uInt32 convertFlags =
-        RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
-        RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE |
-        RTL_UNICODETOTEXT_FLAGS_FLUSH |
-        RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
-        RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
-        RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE;
-    PushInt( (unsigned char) OUStringToOString(OUString(aStr[0]), osl_getThreadTextEncoding(), convertFlags).toChar() );
+    if (aStr.isEmpty())
+        PushInt(0);
+    else
+    {
+        //"classic" ByteString conversion flags
+        const sal_uInt32 convertFlags =
+            RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
+            RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE |
+            RTL_UNICODETOTEXT_FLAGS_FLUSH |
+            RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+            RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
+            RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE;
+        PushInt( (unsigned char) OUStringToOString(OUString(aStr[0]), osl_getThreadTextEncoding(), convertFlags).toChar() );
+    }
 }
 
 void ScInterpreter::ScChar()


More information about the Libreoffice-commits mailing list