summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-04-13 18:06:46 +0200
committerEike Rathke <erack@redhat.com>2015-04-20 11:58:39 +0000
commit1daa4ad0c9094ba43b8078e72130d49312da22da (patch)
tree5a41b62f59a533b358d786afc38d65c9df47ba2f
parentc630c9e6eb90f8f2d29be7fe12646835d6af8076 (diff)
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/15287 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit 468b868c6209e26ab29d83ccacd007fcf785402a) Signed-off-by: Michael Stahl <mstahl@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/15425 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/core/tool/interpr1.cxx23
1 files changed, 14 insertions, 9 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c77b72ab1ab3..55917d7154a9 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3254,15 +3254,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() );
+ }
}