summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-02 11:25:29 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-01-24 13:32:27 +0100
commit6b63b534160e5de126d3e30c75534ce29224272f (patch)
tree31e66f723afe8c6abcaa26a5fbd67ff3889a5a13
parentc3a3e52a087ad2c50eb724fc09901006ec66fce8 (diff)
Resolves: tdf#92993 access violation on particular .docx on glyph layout
(cherry picked from commit ae850353151cd6a79f7b4a012d0a411013c841a4) Change-Id: I69dfd6747e37ddb1727dd41b99d1b70eaed83425 Reviewed-on: https://gerrit.libreoffice.org/66857 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--vcl/source/gdi/sallayout.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 6b88e5c7a188..e9adffbce1ee 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1752,7 +1752,9 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
for( n = 0; n < nLevel; ++n )
maFallbackRuns[n].ResetPos();
int nActiveCharPos = nCharPos[0];
- int nLastRunEndChar = (vRtl[nActiveCharPos - mnMinCharPos])?
+ int nActiveCharIndex = nActiveCharPos - mnMinCharPos;
+ // get the end index of the active run
+ int nLastRunEndChar = (nActiveCharIndex >= 0 && vRtl[nActiveCharIndex]) ?
rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
int nRunVisibleEndChar = nCharPos[0];
while( nValid[0] && (nLevel > 0))
@@ -1900,7 +1902,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];