diff options
author | Eike Rathke <erack@redhat.com> | 2015-04-13 18:06:46 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-04-13 18:20:56 +0200 |
commit | 9f52efa43b2d65c0b6c92790cc2859e752bf975f (patch) | |
tree | 46ae52b9944d9c4024fab26f0a04469ec1faa092 | |
parent | c10f132aa823dc1129ab863c97083a03c7859e8c (diff) |
string access out of bounds
Another UniString to OUString conversion fallout.
Change-Id: I5e62b049da3e7f8b5a892ea6aae7110a33564a46
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 09fca4dadd1d..66eef726ad58 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3173,15 +3173,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() |