[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 17 19:05:00 UTC 2021
sw/source/filter/html/htmlplug.cxx | 2 ++
sw/source/filter/html/swhtml.cxx | 10 ++++++++--
sw/source/filter/html/swhtml.hxx | 3 ++-
3 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit b4edda1842c301a06c5528860542153590027b42
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 17 15:31:23 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 17 21:04:26 2021 +0200
ofz#38652 Avoid timeout in html import
Change-Id: Ic2c3b71a96749d613a3a3339824b57eaae2b63ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122267
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index e3cb057759d5..707badeac7ab 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1161,6 +1161,8 @@ void SwHTMLParser::InsertFloatingFrame()
RegisterFlyFrame( pFlyFormat );
m_bInFloatingFrame = true;
+
+ ++m_nFloatingFrames;
}
sal_uInt16 SwHTMLWriter::GuessOLENodeFrameType( const SwNode& rNode )
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 122a4ea88213..053a3c4177e4 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -314,6 +314,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn,
m_bFuzzing(utl::ConfigManager::IsFuzzing()),
m_isInTableStructure(false),
m_nTableDepth( 0 ),
+ m_nFloatingFrames( 0 ),
m_pTempViewFrame(nullptr)
{
// If requested explicitly, then force ignoring of comments (don't create postits for them).
@@ -1463,8 +1464,13 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
break;
case HtmlTokenId::IFRAME_ON:
- InsertFloatingFrame();
- m_bCallNextToken = m_bInFloatingFrame && m_xTable;
+ if (m_bFuzzing && m_nFloatingFrames > 64)
+ SAL_WARN("sw.html", "Not importing any more FloatingFrames for fuzzing performance");
+ else
+ {
+ InsertFloatingFrame();
+ m_bCallNextToken = m_bInFloatingFrame && m_xTable;
+ }
break;
case HtmlTokenId::LINEBREAK:
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index d2b1fad6bca2..d4f65b2616a2 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -472,7 +472,8 @@ class SwHTMLParser : public SfxHTMLParser, public SvtListener
bool m_bFuzzing;
bool m_isInTableStructure;
- sal_Int32 m_nTableDepth;
+ int m_nTableDepth;
+ int m_nFloatingFrames;
/// the names corresponding to the DOCINFO field subtypes INFO[1-4]
OUString m_InfoNames[4];
More information about the Libreoffice-commits
mailing list