summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-30 10:21:37 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-30 13:01:24 +0200
commitd3a6694c0245100f6c83cabd2a9473dab07c1763 (patch)
treedf994895d8f692baa235089749d8d2674950f55d
parent431dc963a0d18341c9b4869a2a64009b7ff7f699 (diff)
crashtesting: assert/crash on export of fdo66241-1.ods to xls
and others, e.g. ooo101471-3.odf fdo68105-1.ods fdo66241-1.ods fdo68105-2.ods fdo64646-4.xls ooo101471-2.sxc Change-Id: I5a639cc6539130bc6a7ada00652d02529544f650 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153800 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sc/source/filter/inc/XclExpChangeTrack.hxx12
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx26
2 files changed, 38 insertions, 0 deletions
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index 9701ba6e29f5..a6cdeff93cab 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -378,6 +378,9 @@ protected:
// override to get action size without header, called by GetLen()
virtual std::size_t GetActionByteCount() const = 0;
+ // true if export would attempt to get the tab id of an unknown tab
+ virtual bool UsesDeletedTab() const = 0;
+
// do something before writing the record
virtual void PrepareSaveAction( XclExpStream& rStrm ) const;
// do something after writing the record
@@ -479,6 +482,8 @@ class XclExpChTrCellContent final : public XclExpChTrAction, protected XclExpRoo
const XclExpRoot& rRoot, const ScCellValue& rScCell, std::unique_ptr<XclExpChTrData>& rpData,
sal_uInt32& rXclLength1, sal_uInt16& rXclLength2 );
+ virtual bool UsesDeletedTab() const override;
+
virtual void SaveActionData( XclExpStream& rStrm ) const override;
public:
@@ -505,6 +510,8 @@ protected:
XclExpChTrInsert( const XclExpChTrInsert& rCopy );
+ virtual bool UsesDeletedTab() const override;
+
virtual void SaveActionData( XclExpStream& rStrm ) const override;
virtual void PrepareSaveAction( XclExpStream& rStrm ) const override;
virtual void CompleteSaveAction( XclExpStream& rStrm ) const override;
@@ -531,6 +538,9 @@ private:
SCTAB nTab;
protected:
+
+ virtual bool UsesDeletedTab() const override;
+
virtual void SaveActionData( XclExpStream& rStrm ) const override;
public:
@@ -553,6 +563,8 @@ class XclExpChTrMoveRange final : public XclExpChTrAction
ScRange aSourceRange;
ScRange aDestRange;
+ virtual bool UsesDeletedTab() const override;
+
virtual void SaveActionData( XclExpStream& rStrm ) const override;
virtual void PrepareSaveAction( XclExpStream& rStrm ) const override;
virtual void CompleteSaveAction( XclExpStream& rStrm ) const override;
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 71156df08e04..24da37109d29 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -717,6 +717,11 @@ void XclExpChTrAction::CompleteSaveAction( XclExpStream& /*rStrm*/ ) const
void XclExpChTrAction::Save( XclExpStream& rStrm )
{
+ if (UsesDeletedTab())
+ {
+ SAL_WARN("sc", "XclExpChTrAction : unable to export position with tab of EXC_TAB_DELETED");
+ return;
+ }
PrepareSaveAction( rStrm );
ExcRecord::Save( rStrm );
if( pAddAction )
@@ -927,6 +932,11 @@ void XclExpChTrCellContent::GetCellData(
}
}
+bool XclExpChTrCellContent::UsesDeletedTab() const
+{
+ return IsDeletedTab(aPosition.Tab());
+}
+
void XclExpChTrCellContent::SaveActionData( XclExpStream& rStrm ) const
{
WriteTabId( rStrm, aPosition.Tab() );
@@ -1117,6 +1127,11 @@ XclExpChTrInsert::~XclExpChTrInsert()
{
}
+bool XclExpChTrInsert::UsesDeletedTab() const
+{
+ return IsDeletedTab(aRange.aStart.Tab());
+}
+
void XclExpChTrInsert::SaveActionData( XclExpStream& rStrm ) const
{
WriteTabId( rStrm, aRange.aStart.Tab() );
@@ -1206,6 +1221,11 @@ XclExpChTrInsertTab::~XclExpChTrInsertTab()
{
}
+bool XclExpChTrInsertTab::UsesDeletedTab() const
+{
+ return IsDeletedTab(nTab);
+}
+
void XclExpChTrInsertTab::SaveActionData( XclExpStream& rStrm ) const
{
WriteTabId( rStrm, nTab );
@@ -1262,6 +1282,12 @@ XclExpChTrMoveRange::~XclExpChTrMoveRange()
{
}
+bool XclExpChTrMoveRange::UsesDeletedTab() const
+{
+ return IsDeletedTab(aDestRange.aStart.Tab()) ||
+ IsDeletedTab(aSourceRange.aStart.Tab());
+}
+
void XclExpChTrMoveRange::SaveActionData( XclExpStream& rStrm ) const
{
WriteTabId( rStrm, aDestRange.aStart.Tab() );