summaryrefslogtreecommitdiffstats
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-25 17:42:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-08-26 09:56:08 +0200
commitb67f42c4c2906b7059b93d748c8efccd588b1e1c (patch)
tree5391d1f531a75b3ba8873dda3b0ee71122d8b479 /lotuswordpro
parentThere is no --disable-neon configure option any more (diff)
downloadcore-b67f42c4c2906b7059b93d748c8efccd588b1e1c.tar.gz
core-b67f42c4c2906b7059b93d748c8efccd588b1e1c.zip
ofz#35646 Indirect-leak
Change-Id: Ie79d9c49b6beef04ab111a63166abc7f093ad36b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121041 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/inc/xfilter/xftable.hxx2
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/ofz35646-1.lwpbin0 -> 21426 bytes
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcell.cxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.cxx32
4 files changed, 34 insertions, 2 deletions
diff --git a/lotuswordpro/inc/xfilter/xftable.hxx b/lotuswordpro/inc/xfilter/xftable.hxx
index f36a1f295be6..ce292f3a258c 100644
--- a/lotuswordpro/inc/xfilter/xftable.hxx
+++ b/lotuswordpro/inc/xfilter/xftable.hxx
@@ -115,6 +115,8 @@ private:
OUString m_strDefCellStyle;
OUString m_strDefRowStyle;
OUString m_strDefColStyle;
+
+ bool ContainsTable(const XFTable* pTable) const;
};
inline void XFTable::SetTableName(const OUString& name)
diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz35646-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz35646-1.lwp
new file mode 100644
index 000000000000..5db8cea8c5bd
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/ofz35646-1.lwp
Binary files differ
diff --git a/lotuswordpro/source/filter/xfilter/xfcell.cxx b/lotuswordpro/source/filter/xfilter/xfcell.cxx
index bbfde6eab9f3..dfc5889db652 100644
--- a/lotuswordpro/source/filter/xfilter/xfcell.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcell.cxx
@@ -157,7 +157,7 @@ OUString XFCell::GetCellName()
return name;
}
-void XFCell::ToXml(IXFStream *pStrm)
+void XFCell::ToXml(IXFStream *pStrm)
{
IXFAttrList *pAttrList = pStrm->GetAttrList();
diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx
index 6acb1b21a35f..4326f218b1e2 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.cxx
@@ -81,6 +81,30 @@ void XFTable::SetColumnStyle(sal_Int32 col, const OUString& style)
m_aColumns[col] = style;
}
+bool XFTable::ContainsTable(const XFTable* pTable) const
+{
+ for (auto const& elem : m_aRows)
+ {
+ const XFRow *pRow = elem.second.get();
+
+ for (sal_Int32 i = 0; i < pRow->GetCellCount(); ++i)
+ {
+ const XFCell* pCell = pRow->GetCell(i + 1); //starts at 1, not 0
+ if (const XFTable* pSubTable = pCell->GetSubTable())
+ {
+ if (pSubTable == pTable)
+ return true;
+ if (pTable->ContainsTable(pTable))
+ return true;
+ }
+ if (pCell->HierarchyContains(pTable))
+ return true;
+ }
+ }
+
+ return false;
+}
+
void XFTable::AddRow(rtl::Reference<XFRow> const & rRow)
{
assert(rRow);
@@ -88,8 +112,14 @@ void XFTable::AddRow(rtl::Reference<XFRow> const & rRow)
for (sal_Int32 i = 0; i < rRow->GetCellCount(); ++i)
{
XFCell* pFirstCell = rRow->GetCell(i + 1); //starts at 1, not 0
- if (pFirstCell->GetSubTable() == this || pFirstCell->HierarchyContains(this))
+ if (const XFTable* pSubTable = pFirstCell->GetSubTable())
+ {
+ if (pSubTable == this || pSubTable->ContainsTable(this))
+ throw std::runtime_error("table is a subtable of itself");
+ }
+ if (pFirstCell->HierarchyContains(this))
throw std::runtime_error("table is a subtable of itself");
+
}
int row = rRow->GetRow();