summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-17 16:24:16 +0000
committerAndras Timar <andras.timar@collabora.com>2022-03-25 12:58:50 +0100
commitc958ff4da3fc809b588b36ab11231e2257ebdb00 (patch)
treeda856c9809825cb75f1352ac27272b0b874bfa51
parente4c6cc21754f8275d3f84e933a8018d41426971c (diff)
Resolves: tdf#148053 fix a crash in out of range dx array
also seen with tdf#124116 Change-Id: I211c5b9d58ee5857c8286b2009e4159b35a9e047 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131602 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sw/source/core/txtnode/fntcache.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 6ceaeaf99206..64da82258a83 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2189,6 +2189,10 @@ TextFrameIndex SwFntObj::GetModelPositionForViewPoint(SwDrawTextInfo &rInf)
if ( nIdx <= nLastIdx )
break;
+ // the next character might be outside the layout range (e.g tdf124116-1.odt)
+ if (nIdx > nEnd)
+ nIdx = nEnd;
+
nLeft = nRight;
nRight = aKernArray[sal_Int32(nIdx - rInf.GetIdx()) - 1] + nKernSum + nSpaceSum;