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

New commits:
commit 3ff4194a8acff9da2cad7776cfd57f82bc71ce25
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Dec 21 16:06:08 2022 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Dec 21 20:19:00 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/+/144692
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1fd0d4174346..377c133c8192 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3746,15 +3746,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