sw/source/core/crsr/crsrsh.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a8d70435eeeadf73b24dbb9fa035935b9da7ad4e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Jan 20 09:21:46 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Jan 20 12:39:45 2023 +0000

    Resolves: tdf#153116 null-ptr-deref in get-surrounding-text
    
     #0  SwFrame::IsTextFrame() const (this=0x0) at 
sw/source/core/inc/frame.hxx:1236
     #1  0x00007fffa8dcb865 in sw::FrameContainsNode(SwContentFrame const&, 
o3tl::strong_int<int, Tag_SwNodeOffset>) (rFrame=..., nNodeIndex=...) at 
sw/source/core/text/txtfrm.cxx:292
     #2  0x00007fffa82c9fd4 in SwCursorShell::GetSelText() const 
(this=0x5509470) at sw/source/core/crsr/crsrsh.cxx:2565
     #3  0x00007fffa89017f0 in SwEditShell::GetSelectedText(rtl::OUString&, 
ParaBreakType) (this=0x5509470, rBuf="", nHndlParaBrk=ParaBreakType::ToOnlyCR)
         at sw/source/core/edit/edglss.cxx:264
     #4  0x00007fffa97e19a7 in SwEditWin::GetSurroundingText() const 
(this=0x4f1a9f0) at sw/source/uibase/docvw/edtwin.cxx:6628
     #5  0x00007fffee27cf02 in ImplHandleSurroundingTextRequest(vcl::Window*, 
rtl::OUString&, Selection&) (pWindow=0x1fe43f0, rText="", rSelRange=...) at 
vcl/source/window/winproc.cxx:2544
     #6  0x00007fffee27adf7 in 
ImplHandleSalSurroundingTextRequest(vcl::Window*, 
SalSurroundingTextRequestEvent*) (pWindow=0x1fe43f0, pEvt=0x7fffffffb970)
         at vcl/source/window/winproc.cxx:2555
     #7  0x00007fffee276ed6 in ImplWindowFrameProc(vcl::Window*, SalEvent, void 
const*) (_pWindow=0x1fe43f0, nEvent=SalEvent::SurroundingTextRequest, 
pEvent=0x7fffffffb970)
         at vcl/source/window/winproc.cxx:2884
     #8  0x00007fffe6ee3080 in SalFrame::CallCallback(SalEvent, void const*) 
const (this=0x1898310, nEvent=SalEvent::SurroundingTextRequest, 
pEvent=0x7fffffffb970) at vcl/inc/salframe.hxx:306
    
    Change-Id: I7330865b5dda7766a6da08f57a7dd8dd1a09d198
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145873
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index a2abb6a6e5e9..4817c422a51c 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2562,7 +2562,7 @@ OUString SwCursorShell::GetSelText() const
     if (GetLayout()->HasMergedParas())
     {
         SwContentFrame const*const pFrame(GetCurrFrame(false));
-        if (FrameContainsNode(*pFrame, 
m_pCurrentCursor->GetMark()->nNode.GetIndex()))
+        if (pFrame && FrameContainsNode(*pFrame, 
m_pCurrentCursor->GetMark()->nNode.GetIndex()))
         {
             OUStringBuffer buf;
             SwPosition const*const pStart(m_pCurrentCursor->Start());

Reply via email to