writerfilter/source/dmapper/DomainMapper_Impl.cxx |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

New commits:
commit d7a36f2aa08ebb454b284a9e624323fa0081645f
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Dec 21 16:06:08 2022 +0000
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 22 07:20:45 2022 +0000

    ofz#54461 Null-dereference
    
    seen since:
    
    commit 96a856f87f16cca2e039c973c18d57c8b9dca362
    Date:   Fri Dec 16 13:20:25 2022 +0100
    
        tdf#152206 DOCX import: fix mixed first footnote
    
    Note: tdf#152506 is the correct issue identifier.
    
    Change-Id: I6e66db1a6a87cfce444346f193a418880750e03c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144718
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index dc6eb2c8e165..7dc02e91ba8b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3672,15 +3672,25 @@ void DomainMapper_Impl::PopFootOrEndnote()
                 {
                     if ( m_nFirstFootnoteIndex == -1 )
                         lcl_convertToNoteIndices(m_aFootnoteIds, 
m_nFirstFootnoteIndex);
-                    xFootnotes->getByIndex(m_aFootnoteIds.front()) >>= 
xNoteFirst;
-                    m_aFootnoteIds.pop_front();
+                    if (m_aFootnoteIds.empty()) // lcl_convertToNoteIndices 
pops m_aFootnoteIds
+                        m_bSaxError = true;
+                    else
+                    {
+                        xFootnotes->getByIndex(m_aFootnoteIds.front()) >>= 
xNoteFirst;
+                        m_aFootnoteIds.pop_front();
+                    }
                 }
                 else if ( !IsInFootnote() && !m_aEndnoteIds.empty() )
                 {
                     if ( m_nFirstEndnoteIndex == -1 )
                         lcl_convertToNoteIndices(m_aEndnoteIds, 
m_nFirstEndnoteIndex);
-                    xEndnotes->getByIndex(m_aEndnoteIds.front()) >>= 
xNoteFirst;
-                    m_aEndnoteIds.pop_front();
+                    if (m_aEndnoteIds.empty()) // lcl_convertToNoteIndices 
pops m_aEndnoteIds
+                        m_bSaxError = true;
+                    else
+                    {
+                        xEndnotes->getByIndex(m_aEndnoteIds.front()) >>= 
xNoteFirst;
+                        m_aEndnoteIds.pop_front();
+                    }
                 }
                 else
                     m_bSaxError = true;

Reply via email to