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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 8 16:57:54 UTC 2020


 lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp |binary
 lotuswordpro/source/filter/lwptablelayout.cxx    |    6 ++++++
 lotuswordpro/source/filter/lwptablelayout.hxx    |    1 +
 3 files changed, 7 insertions(+)

New commits:
commit c13c136da5506ae8055c47a5385c1833ab0ba0f6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 7 15:15:37 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Feb 8 17:57:22 2020 +0100

    ofz#20504 Indirect-leak
    
    lets assume a table should be only assigned to one container
    
    Change-Id: I4e33bc3dab37c20ac2337b12ae4ee4efe84cb5aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88215
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp
new file mode 100644
index 000000000000..afbf5780426f
Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp differ
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 6cf91d345506..3191374b35b0 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -421,6 +421,7 @@ LwpTableLayout::LwpTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm
     , m_nRows(0)
     , m_nCols(0)
     , m_pDefaultCellLayout(nullptr)
+    , m_bConverted(false)
 {
 }
 
@@ -782,6 +783,7 @@ void LwpTableLayout::ParseTable()
 
     // set name of object
     m_pXFTable.set(new XFTable);
+
     m_pXFTable->SetTableName(pSuper->GetName().str());
     // set table style
     m_pXFTable->SetStyleName(m_StyleName);
@@ -837,8 +839,12 @@ void LwpTableLayout::XFConvert(XFContentContainer* pCont)
 {
     if (!m_pXFTable)
         return;
+    if (m_bConverted)
+        throw std::runtime_error("already added to a container");
     pCont->Add(m_pXFTable.get());
+    m_bConverted = true;
 }
+
 /**
  * @short   convert heading row
  * @param  pXFTable - pointer of table
diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx
index 9cc0c885aa49..af6a92945b57 100644
--- a/lotuswordpro/source/filter/lwptablelayout.hxx
+++ b/lotuswordpro/source/filter/lwptablelayout.hxx
@@ -163,6 +163,7 @@ private:
     std::map<sal_uInt16,LwpRowLayout*> m_RowsMap;
     void SplitConflictCells();
     rtl::Reference<XFTable> m_pXFTable;
+    bool m_bConverted;
     std::map<std::pair<sal_uInt16,sal_uInt8>,XFCell*> m_CellsMap;
 
     void PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID);


More information about the Libreoffice-commits mailing list