sw/source/uibase/misc/redlndlg.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 5b9a6092ed0f0d96ce39e64e493089d9a65f257c
Author:     Justin Luth <[email protected]>
AuthorDate: Thu Sep 18 08:16:47 2025 -0400
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Wed Oct 8 15:13:52 2025 +0200

    tdf#168377 sw: avoid crash in redlndlg - index out of range
    
    Everywhere else GetRedlinePos() is used
    it is checked against SwRedlineTable::npos
    to identify a valid index position.
    
    Change-Id: I46a52a9c7aadab4b1690562c0ba32027cd2dcd2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191121
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <[email protected]>
    (cherry picked from commit c920581dc81e553a07d0cd27f5d218df39811b6d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191137
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit d24e8a20907bf3e861dad93456d0dea891c3b320)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191165
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index d1180be8271a..f153028d787e 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1116,10 +1116,13 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool 
bSelect, bool bAccept )
             if ( !bSelect && !bAccept && !m_bOnlyFormatedRedlines )
             {
                 SwRedlineTable::size_type nPosition = GetRedlinePos(rEntry);
-                const SwRangeRedline& rRedln = pSh->GetRedline(nPosition);
+                if (nPosition != SwRedlineTable::npos)
+                {
+                    const SwRangeRedline& rRedln = pSh->GetRedline(nPosition);
 
-                if( RedlineType::Format == rRedln.GetType() )
-                    bIsNotFormatted = false;
+                    if (RedlineType::Format == rRedln.GetType())
+                        bIsNotFormatted = false;
+                }
             }
 
             if (!pData->bDisabled && bIsNotFormatted)

Reply via email to