sc/source/filter/excel/xepage.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 3e146b4c8dcc15bb12ef036162090a0301d6aadf
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Feb 23 09:06:31 2025 -0500
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Feb 24 09:30:02 2025 +0100

    sc: filter: check for null Brush
    
    The likely cause of the this crash:
    
/opt/collaboraoffice/program/libmergedlo.so(SvxBrushItem::GetGraphicObject(rtl::OUString
 const&) const+0x25)[0x7faf881f90e5]
    
/opt/collaboraoffice/program/libmergedlo.so(SvxBrushItem::GetGraphic(rtl::OUString
 const&) const+0xd)[0x7faf881f964d]
    /opt/collaboraoffice/program/libscfiltlo.so(+0x1b1dbe)[0x7faf7a32fdbe]
    /opt/collaboraoffice/program/libscfiltlo.so(+0x107371)[0x7faf7a285371]
    
    This was fixed by identifying all the GetGraphic() calls
    on a pointer. This turned out to be the only unprotected
    one in sc/source/filter, where the stack shows.
    
    Signed-off-by: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
    Change-Id: I64175e838423dfeaa4f93762c4894a99236a2ece
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182073
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/source/filter/excel/xepage.cxx 
b/sc/source/filter/excel/xepage.cxx
index 144ab51c076e..1137f8ec4f44 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -489,8 +489,9 @@ void XclExpPageSettings::SaveXml( XclExpXmlStream& rStrm )
 
 XclExpImgData* XclExpPageSettings::getGraphicExport()
 {
-    if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
-        return new XclExpImgData( *pGraphic, EXC_ID8_IMGDATA );
+    if( maData.mxBrushItem )
+        if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
+            return new XclExpImgData( *pGraphic, EXC_ID8_IMGDATA );
 
     return nullptr;
 }

Reply via email to