vcl/source/gdi/sallayout.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 6b63b534160e5de126d3e30c75534ce29224272f
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Oct 2 11:25:29 2015 +0100
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Thu Jan 24 13:32:27 2019 +0100

    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 <[email protected]>
    Tested-by: Thorsten Behrens <[email protected]>

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];
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to