diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-30 15:31:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-30 17:40:47 +0200 |
commit | 25c0988b87b71f93577837f4a300f5f17366d145 (patch) | |
tree | b350027d7f23a51596f2fc7c0ff8a4f2b3f9981d /lotuswordpro/source | |
parent | da0956b279121a8824ac8d44e5365ef67c308a07 (diff) |
ofz#8095 avoid recurse to death
Change-Id: I0acb0f68f64bb95a4510a330d463badd2cf8a84a
Reviewed-on: https://gerrit.libreoffice.org/53663
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r-- | lotuswordpro/source/filter/lwpcelllayout.cxx | 5 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpcelllayout.hxx | 16 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwprowlayout.cxx | 6 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 2 |
4 files changed, 20 insertions, 9 deletions
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index ad80d4aa4048..2d25248c6af7 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -76,6 +76,7 @@ LwpCellLayout::LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) : LwpMiddleLayout(objHdr, pStrm) + , m_bConvertCell(false) , crowid(0) , ccolid(0) , cType(LDT_NONE) @@ -891,11 +892,11 @@ rtl::Reference<XFCell> LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sa LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get()); if (pDefault) { - xXFCell = pDefault->ConvertCell(aTableID, nRow, nCol); + xXFCell = pDefault->DoConvertCell(aTableID, nRow, nCol); } else { - xXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol); + xXFCell = pConnCell->DoConvertCell(aTableID, nRow, nCol); } xXFCell->SetColumnSpaned(pConnCell->GetNumcols()); } diff --git a/lotuswordpro/source/filter/lwpcelllayout.hxx b/lotuswordpro/source/filter/lwpcelllayout.hxx index 4969f568e9a1..5c54b92a1ffc 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.hxx +++ b/lotuswordpro/source/filter/lwpcelllayout.hxx @@ -89,7 +89,15 @@ public: LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm); virtual ~LwpCellLayout() override; virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CELL_LAYOUT;} - virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol); + rtl::Reference<XFCell> DoConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) + { + if (m_bConvertCell) + throw std::runtime_error("recursion in page divisions"); + m_bConvertCell = true; + rtl::Reference<XFCell> aRet = ConvertCell(aTableID, nRow, nCol); + m_bConvertCell = false; + return aRet; + } sal_uInt16 GetRowID(){return crowid;} sal_uInt8 GetColID(){return ccolid;} void RegisterStyle() override; @@ -114,10 +122,12 @@ protected: OUString const & GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout); void RegisterDefaultCell(); virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout); + virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol); static LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout); static sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; }; virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow){return nRow + 1; }; + bool m_bConvertCell; sal_uInt16 crowid; sal_uInt8 ccolid; LwpObjectID cLayNumerics; @@ -147,11 +157,11 @@ public: virtual ~LwpHiddenCellLayout() override; virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HIDDEN_CELL_LAYOUT;} virtual void Parse(IXFStream* pOutputStream) override; - virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override; void RegisterStyle() override {} virtual void SetCellMap() override; private: void Read() override; + virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override; LwpObjectID cconnectedlayout; }; @@ -166,7 +176,6 @@ public: virtual ~LwpConnectedCellLayout() override; virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CONNECTED_CELL_LAYOUT;} virtual void Parse(IXFStream* pOutputStream) override; - virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override; sal_uInt16 GetNumrows(){return m_nRealrowspan;} sal_uInt8 GetNumcols(){return m_nRealcolspan;} virtual void SetCellMap() override; @@ -175,6 +184,7 @@ protected: void Read() override; virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow) override {return nRow + m_nRealrowspan; }; virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout) override; + virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override; sal_uInt16 cnumrows; sal_uInt8 cnumcols; sal_uInt16 m_nRealrowspan; diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index e4d1fdf6c29b..a0a90a417c69 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -232,7 +232,7 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8 { sal_uInt8 nColID = m_ConnCellList[nMarkConnCell]->GetColID() +m_ConnCellList[nMarkConnCell]->GetNumcols()-1; - xXFCell = m_ConnCellList[nMarkConnCell]->ConvertCell( + xXFCell = m_ConnCellList[nMarkConnCell]->DoConvertCell( pTable->GetObjectID(), crowid+m_ConnCellList[nMarkConnCell]->GetNumrows()-1, m_ConnCellList[nMarkConnCell]->GetColID()); @@ -401,7 +401,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa nCellEndCol = i+pConnCell->GetNumcols()-1; i = nCellEndCol; } - xCell = pCellLayout->ConvertCell(pTable->GetObjectID(),crowid,i); + xCell = pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i); break; } rCellID = pCellLayout->GetNext(); @@ -414,7 +414,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa LwpCellLayout * pDefaultCell = pTableLayout->GetDefaultCellLayout(); if (pDefaultCell) { - xCell = pDefaultCell->ConvertCell( + xCell = pDefaultCell->DoConvertCell( pTable->GetObjectID(),crowid, i); } else diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index ff4b7f65a6f9..51d2a25ab641 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -1361,7 +1361,7 @@ void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable, rtl::Reference<XFCell> xCell; if (m_pDefaultCellLayout) { - xCell = m_pDefaultCellLayout->ConvertCell( + xCell = m_pDefaultCellLayout->DoConvertCell( GetTable()->GetObjectID(),nRowID,j+nStartCol); } else |