From 75a3ade6f31c7a1b9b6e1d260eec7130845ed11f Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 7 Apr 2015 14:55:52 +0100 Subject: invalid index on load of ooo86460-1.xls because TextLayoutCache took an OUString arg, passing reinterpret_cast(rArgs.mpStr) as an input created a temp string from mpStr, but ctor stops at first NULL of course unless length arg is passed and input string contains nulls. Just take a sal_Unicode* as input. Change-Id: I452cf6fa61155456fbeceeda105e2e15557a21b3 --- vcl/generic/glyphs/gcach_layout.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'vcl/generic') diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index e42008e369ab..4f98620893e8 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -364,10 +364,10 @@ namespace vcl { { public: std::vector runs; - TextLayoutCache(OUString const& rString, sal_Int32 const nEnd) + TextLayoutCache(sal_Unicode const* pStr, sal_Int32 const nEnd) { vcl::ScriptRun aScriptRun( - reinterpret_cast(rString.getStr()), + reinterpret_cast(pStr), nEnd); while (aScriptRun.next()) { @@ -381,7 +381,7 @@ namespace vcl { std::shared_ptr ServerFontLayout::CreateTextLayoutCache( OUString const& rString) const { - return std::make_shared(rString, rString.getLength()); + return std::make_shared(rString.getStr(), rString.getLength()); } bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) @@ -413,8 +413,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) } else { - pNewScriptRun.reset(new vcl::TextLayoutCache( - reinterpret_cast(rArgs.mpStr), rArgs.mnEndCharPos)); + pNewScriptRun.reset(new vcl::TextLayoutCache(rArgs.mpStr, rArgs.mnEndCharPos)); pTextLayout = pNewScriptRun.get(); } -- cgit