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 <[email protected]>
AuthorDate: Fri Feb 7 15:15:37 2020 +0000
Commit:     Caolán McNamara <[email protected]>
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 <[email protected]>

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);
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to