diff options
author | Henry Castro <hcastro@collabora.com> | 2023-06-26 10:43:34 -0400 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-06-26 21:06:56 +0200 |
commit | 2f6859071031841be0126bc01587fcef0f8b8208 (patch) | |
tree | 246abdd2819ad8e73c6ef2a62dbf91f7e59fc101 | |
parent | 633be9b03c870d9f242279e7f8617ae6daaef460 (diff) |
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/+/153601
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | sc/source/filter/inc/condformatbuffer.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/extlstcontext.cxx | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index e62917678b9a..9c8896dbf22a 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 75171441c23d..649c2417f348 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1376,6 +1376,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 3209c846f9ce..58e4c7931729 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 |