summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-25 11:54:07 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-25 14:09:35 +0200
commitf95c213cc9107e25f78e25c6a1bdfb8a5a61be2a (patch)
tree7efcafd446c75d5e039c497cbb76fa46849375c5
parentbea05a79c8ed565909e341a24b298d8deab7e042 (diff)
crashtesting: crash seen on exporting fdo66241-1.ods to xlsx
Change-Id: I730bd782ddf67555c40651aed1442465574a1c01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153560 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sc/source/filter/inc/XclExpChangeTrack.hxx7
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx23
2 files changed, 29 insertions, 1 deletions
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index 9d007ba368f3..9701ba6e29f5 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -28,6 +28,7 @@
#include "xestring.hxx"
#include "excrecds.hxx"
#include "xlformula.hxx"
+#include "xllink.hxx"
#include "xeformula.hxx"
class ExcXmlRecord : public ExcRecord
@@ -365,6 +366,7 @@ protected:
static inline void Write2DAddress( XclExpStream& rStrm, const ScAddress& rAddress );
static inline void Write2DRange( XclExpStream& rStrm, const ScRange& rRange );
inline sal_uInt16 GetTabId( SCTAB nTabId ) const;
+ inline bool IsDeletedTab( SCTAB nTab ) const;
inline void WriteTabId( XclExpStream& rStrm, SCTAB nTabId ) const;
// save header data, call SaveActionData()
@@ -421,6 +423,11 @@ inline void XclExpChTrAction::Write2DRange( XclExpStream& rStrm, const ScRange&
<< static_cast<sal_uInt16>(rRange.aEnd.Col());
}
+inline bool XclExpChTrAction::IsDeletedTab(SCTAB nTab) const
+{
+ return rTabInfo.GetXclTab(nTab) == EXC_TAB_DELETED;
+}
+
inline sal_uInt16 XclExpChTrAction::GetTabId( SCTAB nTab ) const
{
return rIdBuffer.GetId( rTabInfo.GetXclTab( nTab ) );
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 57fd143bf659..71156df08e04 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -573,7 +573,7 @@ void XclExpChTrTabIdBuffer::InitFillup()
sal_uInt16 XclExpChTrTabIdBuffer::GetId( sal_uInt16 nIndex ) const
{
- OSL_ENSURE( nIndex < nBufSize, "XclExpChTrTabIdBuffer::GetId - out of range" );
+ assert(nIndex < nBufSize && "XclExpChTrTabIdBuffer::GetId - out of range");
return pBuffer[ nIndex ];
}
@@ -1025,6 +1025,13 @@ static void lcl_WriteCell( XclExpXmlStream& rStrm, sal_Int32 nElement, const ScA
void XclExpChTrCellContent::SaveXml( XclExpXmlStream& rRevisionLogStrm )
{
+ if (IsDeletedTab(aPosition.Tab()))
+ {
+ // seen on attempt to export tdf66241-1.ods to xlsx
+ SAL_WARN("sc", "XclExpChTrCellContent: unable to export position with tab of EXC_TAB_DELETED");
+ return;
+ }
+
sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
pStream->startElement( XML_rcc,
XML_rId, OString::number(GetActionNumber()),
@@ -1155,6 +1162,13 @@ static const char* lcl_GetAction( sal_uInt16 nOpCode )
void XclExpChTrInsert::SaveXml( XclExpXmlStream& rRevisionLogStrm )
{
+ if (IsDeletedTab(aRange.aStart.Tab()))
+ {
+ // seen on attempt to export tdf66241-1.ods to xlsx
+ SAL_WARN("sc", "XclExpChTrCellContent: unable to export position with tab of EXC_TAB_DELETED");
+ return;
+ }
+
sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
pStream->startElement( XML_rrc,
XML_rId, OString::number(GetActionNumber()),
@@ -1279,6 +1293,13 @@ std::size_t XclExpChTrMoveRange::GetActionByteCount() const
void XclExpChTrMoveRange::SaveXml( XclExpXmlStream& rRevisionLogStrm )
{
+ if (IsDeletedTab(aDestRange.aStart.Tab()) || IsDeletedTab(aSourceRange.aStart.Tab()))
+ {
+ // seen on attempt to export tdf66241-1.ods to xlsx
+ SAL_WARN("sc", "XclExpChTrCellContent: unable to export position with tab of EXC_TAB_DELETED");
+ return;
+ }
+
sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
pStream->startElement( XML_rm,