summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-17 19:41:35 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-04-17 22:16:22 +0200
commitc80c8ac4eb58812c1b72aa0b0cef01ebb5337359 (patch)
tree92facdf5e07c0aa67b39ebdf8ad97917d0948d20 /lotuswordpro
parentb236b36475ed9a204ac931c34ccc23205296a0a6 (diff)
ofz#27296 Out-of-memory and ofz#27384 Indirect-leak
Revert "ofz#27012 detect deletion of XFCell" This reverts commit e40d28d65222ba462c20ede17da5ef54751932e3. and Revert "ofz#26357 Timeout in lwpfuzzer, 12s -> 1.3s" This reverts commit 473c1b05f7a7a5500a2e15b911263b546792b013. Change-Id: Ia4d37148745259a285523b1b45ca9838c4122b89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114234 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/Library_lwpft.mk2
-rw-r--r--lotuswordpro/inc/xfilter/xfcell.hxx2
-rw-r--r--lotuswordpro/source/filter/lwprowlayout.cxx7
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx17
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.hxx38
5 files changed, 18 insertions, 48 deletions
diff --git a/lotuswordpro/Library_lwpft.mk b/lotuswordpro/Library_lwpft.mk
index 5965b385e1bc..f35568d3647b 100644
--- a/lotuswordpro/Library_lwpft.mk
+++ b/lotuswordpro/Library_lwpft.mk
@@ -27,7 +27,6 @@ $(eval $(call gb_Library_use_libraries,lwpft,\
i18nlangtag \
sfx \
sot \
- svl \
svt \
svxcore \
tl \
@@ -38,7 +37,6 @@ $(eval $(call gb_Library_use_libraries,lwpft,\
$(eval $(call gb_Library_use_externals,lwpft,\
boost_headers \
- mdds_headers \
icui18n \
icuuc \
icu_headers \
diff --git a/lotuswordpro/inc/xfilter/xfcell.hxx b/lotuswordpro/inc/xfilter/xfcell.hxx
index 1e75107019de..81ab8aa59028 100644
--- a/lotuswordpro/inc/xfilter/xfcell.hxx
+++ b/lotuswordpro/inc/xfilter/xfcell.hxx
@@ -63,7 +63,6 @@
#include <xfilter/xfcontent.hxx>
#include <xfilter/xfcontentcontainer.hxx>
-#include <svl/SfxBroadcaster.hxx>
class XFTable;
class XFRow;
@@ -72,7 +71,6 @@ class XFRow;
* @descr Table cell object.
*/
class XFCell : public XFContentContainer
- , public SfxBroadcaster
{
public:
XFCell();
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 9590e41d9670..3321f294469e 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -238,7 +238,9 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8
m_ConnCellList[nMarkConnCell]->GetColID());
//set all cell in this merge cell to cellsmap
- pTableLayout->SetCellsMap(crowid, i, nRowMark - 1, nColID, xXFCell.get());
+ for (sal_uInt16 nRowLoop = crowid; nRowLoop < nRowMark; nRowLoop++)
+ for (sal_uInt16 nColLoop = i; nColLoop < nColID+1; nColLoop++)
+ pTableLayout->SetCellsMap(nRowLoop,nColLoop, xXFCell.get());
i += m_ConnCellList[nMarkConnCell]->GetNumcols();
nMarkConnCell = FindNextMarkConnCell(static_cast<sal_uInt16>(nMarkConnCell),nEndCol);
@@ -431,7 +433,8 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
}
xRow->AddCell(xCell);
- pTableLayout->SetCellsMap(crowid, nCellStartCol, crowid, nCellEndCol, xCell.get()); //set to cellsmap
+ for (sal_uInt8 j=nCellStartCol;j<=nCellEndCol;j++)
+ pTableLayout->SetCellsMap(crowid,j, xCell.get());//set to cellsmap
}
pXFTable->AddRow(xRow);
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 4f2c4c8d30ca..1deb854f333c 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -1415,10 +1415,10 @@ void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable,
* @param nRow - row id
* @param nCol - column id
*/
-void LwpTableLayout::SetCellsMap(sal_uInt16 nRow1, sal_uInt8 nCol1,
- sal_uInt16 nRow2, sal_uInt8 nCol2, XFCell* pXFCell)
+void LwpTableLayout::SetCellsMap(sal_uInt16 nRow, sal_uInt8 nCol, XFCell* pXFCell)
{
- m_CellsMap.insert({{nRow1, nCol1}, {nRow2, nCol2}}, pXFCell);
+ // combine the 16bit nRow and 8bit nCol into a single 32bit number
+ m_CellsMap.insert(std::make_pair((nRow << 8) | nCol, pXFCell));
}
/**
@@ -1429,12 +1429,13 @@ void LwpTableLayout::SetCellsMap(sal_uInt16 nRow1, sal_uInt8 nCol1,
*/
XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow, sal_uInt8 nCol)
{
- auto results = m_CellsMap.search({{nRow, nCol}, {nRow, nCol}}, rt_type::search_type::overlap);
- if (results.begin() == results.end())
- return nullptr;
- // return the last thing inserted for this position
- return std::prev(results.end())->GetCell();
+ RowCol pos = (nRow << 8) | nCol;
+ auto iter = m_CellsMap.find(pos);
+ if (iter == m_CellsMap.end())
+ return nullptr;
+ return iter->second;
}
+
/**
* @descr Get row layout by row id
* @param nRow - row id
diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx
index ca4d46812e55..21ab84ec1c67 100644
--- a/lotuswordpro/source/filter/lwptablelayout.hxx
+++ b/lotuswordpro/source/filter/lwptablelayout.hxx
@@ -63,14 +63,11 @@
#include "lwplayout.hxx"
#include <xfilter/xftable.hxx>
-#include <svl/hint.hxx>
-#include <svl/lstner.hxx>
-
-#include <mdds/rtree.hpp>
#include <vector>
#include <map>
#include <memory>
+#include <unordered_map>
class XFTableStyle;
class XFTable;
@@ -98,31 +95,6 @@ struct TableConvertAttempt
}
};
-class XFCellListener : public SfxListener
-{
-public:
- XFCellListener(XFCell* pCell)
- : m_pCell(pCell)
- {
- if (m_pCell)
- StartListening(*m_pCell);
- }
-
- XFCell* GetCell()
- {
- return m_pCell;
- }
-
-private:
- XFCell* m_pCell;
-
- virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override
- {
- if (rHint.GetId() == SfxHintId::Dying)
- m_pCell = nullptr;
- }
-};
-
/**
* @brief
* VO_TABLELAYOUT object and functions for registering styles and converting tables
@@ -176,7 +148,7 @@ public:
void ConvertTable(rtl::Reference<XFTable> const & pXFTable, sal_uInt16 nStartRow,
sal_uInt16 nEndRow,sal_uInt8 nStartCol,sal_uInt8 nEndCol);
const OUString& GetDefaultRowStyleName() const {return m_DefaultRowStyleName;}
- void SetCellsMap(sal_uInt16 nRow1, sal_uInt8 nCol1, sal_uInt16 nRow2, sal_uInt8 nCol2, XFCell* pXFCell);
+ void SetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol,XFCell* pXFCell);
XFCell* GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol);
const std::map<sal_uInt16,LwpRowLayout*>& GetRowsMap() const {return m_RowsMap;}
LwpRowLayout* GetRowLayout(sal_uInt16 nRow);
@@ -193,13 +165,11 @@ private:
void SplitConflictCells();
rtl::Reference<XFTable> m_pXFTable;
bool m_bConverted;
-
- using rt_type = mdds::rtree<int, XFCellListener>;
- rt_type m_CellsMap;
+ typedef sal_Int32 RowCol;
+ std::unordered_map<RowCol, XFCell*> m_CellsMap;
void PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID);
};
-
/**
* @brief
* VO_SUPERTABLELAYOUT object