sc/source/filter/html/htmlpars.cxx | 16 ++++++++-------- sc/source/filter/inc/htmlpars.hxx | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-)
New commits: commit 5e87504307c078a027ad12c66a340579d15c6fb8 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Mar 19 10:11:43 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Mar 20 09:21:32 2024 +0100 leaks in initial corpus for sc html import fuzzing Change-Id: If5bfc9fb557fd449de8173790712f622a1c925ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165020 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index c969fa11a205..232a3d9c84fa 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -331,8 +331,8 @@ ScHTMLLayoutParser::~ScHTMLLayoutParser() xLocalColOffset.reset(); if ( pTables ) { - for( const auto& rEntry : *pTables) - delete rEntry.second; + for( auto& rEntry : *pTables) + rEntry.second.reset(); pTables.reset(); } } @@ -592,7 +592,7 @@ void ScHTMLLayoutParser::Adjust() { OuterMap::const_iterator it = pTables->find( nTab ); if ( it != pTables->end() ) - pTab = it->second; + pTab = it->second.get(); } } @@ -627,7 +627,7 @@ void ScHTMLLayoutParser::Adjust() { OuterMap::const_iterator it = pTables->find( nTab ); if ( it != pTables->end() ) - pTab = it->second; + pTab = it->second.get(); } // New line spacing SCROW nR = 0; @@ -1272,10 +1272,10 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo ) if ( it == pTables->end() ) { pTab1 = new InnerMap; - (*pTables)[ nTab ] = pTab1; + (*pTables)[ nTab ].reset(pTab1); } else - pTab1 = it->second; + pTab1 = it->second.get(); SCROW nRowSpan = pE->nRowOverlap; SCROW nRowKGV; SCROW nRowsPerRow1; // Outer table @@ -1295,7 +1295,7 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo ) if ( nRowsPerRow2 > 1 ) { // Height of the inner table pTab2 = new InnerMap; - (*pTables)[ nTable ] = pTab2; + (*pTables)[ nTable ].reset(pTab2); } // Abuse void* Data entry of the Table class for height mapping if ( nRowKGV > 1 ) @@ -1334,7 +1334,7 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo ) if ( !pTab2 ) { // nRowsPerRow2 could be've been incremented pTab2 = new InnerMap; - (*pTables)[ nTable ] = pTab2; + (*pTables)[ nTable ].reset(pTab2); } for ( SCROW j=0; j < nRows; j++ ) { diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index 7043c9176182..a03d1c4d5fca 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -148,7 +148,7 @@ class HTMLOption; // TODO these need better names typedef ::std::map<SCROW, SCROW> InnerMap; -typedef ::std::map<sal_uInt16, InnerMap*> OuterMap; +typedef ::std::map<sal_uInt16, std::unique_ptr<InnerMap>> OuterMap; /// HTML parser used during paste into Calc. class ScHTMLLayoutParser : public ScHTMLParser