diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-07 15:15:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-08 17:57:22 +0100 |
commit | c13c136da5506ae8055c47a5385c1833ab0ba0f6 (patch) | |
tree | 2c98e8f5e7302f91a7034400f3c0c560518aaa86 | |
parent | ec48d37f574924c66dea4f7adb56944bbe636aa1 (diff) |
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@redhat.com>
-rw-r--r-- | lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp | bin | 0 -> 21427 bytes | |||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 6 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.hxx | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp Binary files differnew file mode 100644 index 000000000000..afbf5780426f --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp 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); |