[Libreoffice-commits] core.git: sw/qa sw/source

Caolán McNamara caolanm at redhat.com
Mon Feb 5 14:02:41 UTC 2018


 sw/qa/core/data/html/fail/ofz5909-1.html |    1 +
 sw/source/filter/html/htmltab.cxx        |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 5090d575117fbe6ced75dc45c514f8d990523251
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 4 21:02:37 2018 +0000

    ofz#5909 Null-dereference READ
    
    Change-Id: I830d3e8bda517e7681cea7481c32457486ced693
    Reviewed-on: https://gerrit.libreoffice.org/49218
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/core/data/html/fail/ofz5909-1.html b/sw/qa/core/data/html/fail/ofz5909-1.html
new file mode 100644
index 000000000000..9511b2bc1eac
--- /dev/null
+++ b/sw/qa/core/data/html/fail/ofz5909-1.html
@@ -0,0 +1 @@
+<table><td><a class="sdfootnoteanc"href=" sdfootnote1   "></a><div id="sdfootnote1"><table><td>
\ No newline at end of file
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index b1b273ddc531..fa9a8a6e9f87 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -2296,6 +2296,12 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
         break;
     }
 
+    if (!m_pSwTable)
+    {
+        SAL_WARN("sw.html", "no table");
+        return;
+    }
+
     // get the table format and adapt it
     SwFrameFormat *pFrameFormat = m_pSwTable->GetFrameFormat();
     pFrameFormat->SetFormatAttr( SwFormatHoriOrient(0, eHoriOri) );
@@ -5196,8 +5202,9 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust,
             m_bUpperSpace = true;
             SetTextCollAttrs();
 
-            m_nParaCnt = m_nParaCnt - std::min(m_nParaCnt,
-                pTCntxt->GetTableNode()->GetTable().GetTabSortBoxes().size());
+            SwTableNode* pTableNode = pTCntxt->GetTableNode();
+            size_t nTableBoxSize = pTableNode ? pTableNode->GetTable().GetTabSortBoxes().size() : 0;
+            m_nParaCnt = m_nParaCnt - std::min(m_nParaCnt, nTableBoxSize);
 
             // Jump to a table if needed
             if( JUMPTO_TABLE == m_eJumpTo && m_xTable->GetSwTable() &&


More information about the Libreoffice-commits mailing list