sw/source/core/txtnode/fntcache.cxx | 4 ++++ 1 file changed, 4 insertions(+)
New commits: commit d64ba1048716767db6fd3daedb637df193c7071b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Mar 17 16:24:16 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Mar 17 22:18:27 2022 +0100 Related: 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/+/131713 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index e48c5e0e9953..7afb53d29a9c 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2178,6 +2178,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;