summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2023-06-26 10:43:34 -0400
committerHenry Castro <hcastro@collabora.com>2023-06-29 04:14:07 +0200
commitcffbf2f559cc2092de67b6c25b6ff8c01f863acf (patch)
tree428a59080e8382ec80864fe5f36f51686560e553
parentBump version to 22.05.16.1 (diff)
downloadcore-cffbf2f559cc2092de67b6c25b6ff8c01f863acf.tar.gz
core-cffbf2f559cc2092de67b6c25b6ff8c01f863acf.zip
sc: filter: oox: fix crash delete ScDatabarFormatData
Unfortunately, the instance of "ScDatabarFormatData" is deleted before finalizeImport is called. The "maEntries" is not usable, the global format buffer is required to hold the reference. #1 0x7f2ef19081c0 in oox::xls::CondFormatBuffer::finalizeImport() co-23.05-asan/sc/source/filter/oox/condformatbuffer.cxx:1322:23 #2 0x7f2ef1b9999a in oox::xls::WorksheetGlobals::finalizeWorksheetImport() co-23.05-asan/sc/source/filter/oox/worksheethelper.cxx:942:22 #3 0x7f2ef58d030e in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) co-23.05-asan/sax/source/fastparser/fastparser.cxx:910:36 #4 0x7f2ef23f0e46 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) co-23.05-asan/oox/source/core/fastparser.cxx:121:15 #5 0x7f2ef23f1544 in Signed-off-by: Henry Castro <hcastro@collabora.com> Change-Id: Ieb3840cc10372867d5462a19d9efa9771f633437 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153622 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r--sc/source/filter/inc/condformatbuffer.hxx2
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx5
-rw-r--r--sc/source/filter/oox/extlstcontext.cxx2
3 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index dfb665befe39..acd6f1b398b8 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -307,6 +307,7 @@ public:
CondFormatRef importCondFormatting( SequenceInputStream& rStrm );
ExtCfDataBarRuleRef createExtCfDataBarRule(ScDataBarFormatData* pTarget);
std::vector< std::unique_ptr<ExtCfCondFormat> >& importExtCondFormat();
+ std::vector<std::unique_ptr<ScFormatEntry> >& importExtFormatEntries();
/** Converts an OOXML condition operator token to the API constant. */
static sal_Int32 convertToApiOperator( sal_Int32 nToken );
@@ -324,6 +325,7 @@ private:
CondFormatVec maCondFormats; /// All conditional formatting in a sheet.
ExtCfDataBarRuleVec maCfRules; /// All external conditional formatting rules in a sheet.
std::vector< std::unique_ptr<ExtCfCondFormat> > maExtCondFormats;
+ std::vector<std::unique_ptr<ScFormatEntry> > maExtFormatEntries;
sal_Int32 mnNonPrioritizedRuleNextPriority = 1048576;
};
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index e8535c78755d..5e64e75b3899 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1353,6 +1353,11 @@ std::vector< std::unique_ptr<ExtCfCondFormat> >& CondFormatBuffer::importExtCond
return maExtCondFormats;
}
+std::vector<std::unique_ptr<ScFormatEntry> >& CondFormatBuffer::importExtFormatEntries()
+{
+ return maExtFormatEntries;
+}
+
sal_Int32 CondFormatBuffer::convertToApiOperator( sal_Int32 nToken )
{
switch( nToken )
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 945e6dbfd988..e12ac00938b7 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -174,7 +174,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
{
auto pFormat = std::make_unique<ScDataBarFormat>(&getScDocument());
pFormat->SetDataBarData(pInfo);
- maEntries.push_back(std::move(pFormat));
+ getCondFormats().importExtFormatEntries().push_back(std::move(pFormat));
}
}
else