From ae850353151cd6a79f7b4a012d0a411013c841a4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 2 Oct 2015 11:25:29 +0100 Subject: Resolves: tdf#92993 access violation on particular .docx on glyph layout Change-Id: I69dfd6747e37ddb1727dd41b99d1b70eaed83425 --- vcl/source/gdi/sallayout.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 0154aaafedee..eefcd57e23af 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1650,8 +1650,9 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) maFallbackRuns[n].ResetPos(); // get the next codepoint index that needs fallback int nActiveCharPos = nCharPos[0]; + int nActiveCharIndex = nActiveCharPos - mnMinCharPos; // get the end index of the active run - int nLastRunEndChar = (vRtl[nActiveCharPos - mnMinCharPos])? + int nLastRunEndChar = (nActiveCharIndex >= 0 && vRtl[nActiveCharIndex]) ? rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1; int nRunVisibleEndChar = nCharPos[0]; // merge the fallback levels @@ -1800,7 +1801,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( !bLTR ) nOldRunAdv = -nOldRunAdv; #endif - if (vRtl[nActiveCharPos - mnMinCharPos]) + nActiveCharIndex = nActiveCharPos - mnMinCharPos; + if (nActiveCharIndex >= 0 && vRtl[nActiveCharIndex]) { if (nRunVisibleEndChar > mnMinCharPos && nRunVisibleEndChar <= mnEndCharPos) nRunAdvance -= aMultiArgs.mpDXArray[nRunVisibleEndChar - 1 - mnMinCharPos]; -- cgit