sw/source/filter/html/swhtml.cxx |   16 +++++++++++++---
 sw/source/filter/html/swhtml.hxx |    1 +
 2 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 1a6401578ec32510342e232699889527cca914b8
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Sep 20 10:24:27 2021 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Sep 20 12:36:11 2021 +0200

    ofz: avoid Timeout
    
    Change-Id: I941a5b9b930248236f35b31582ee8f2c9e0be16e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122348
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 053a3c4177e4..df8abc1e65d9 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -315,6 +315,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
     m_isInTableStructure(false),
     m_nTableDepth( 0 ),
     m_nFloatingFrames( 0 ),
+    m_nListItems( 0 ),
     m_pTempViewFrame(nullptr)
 {
     // If requested explicitly, then force ignoring of comments (don't create 
postits for them).
@@ -1827,10 +1828,19 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
             EndPara();
         }
 
-        EndNumberBulletListItem( HtmlTokenId::NONE, false );// close <LI>/<LH> 
and don't set a template
-        NewNumberBulletListItem( nToken );
-        break;
+        if (m_bFuzzing && m_nListItems > 1024)
+        {
+            SAL_WARN("sw.html", "skipping remaining bullet import for 
performance during fuzzing");
+        }
+        else
+        {
+            EndNumberBulletListItem( HtmlTokenId::NONE, false );// close 
<LI>/<LH> and don't set a template
+            NewNumberBulletListItem( nToken );
+        }
 
+        ++m_nListItems;
+
+        break;
     case HtmlTokenId::LI_OFF:
     case HtmlTokenId::LISTHEADER_OFF:
         EndNumberBulletListItem( nToken, false );
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index d4f65b2616a2..6ed83640bad5 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -474,6 +474,7 @@ class SwHTMLParser : public SfxHTMLParser, public 
SvtListener
 
     int m_nTableDepth;
     int m_nFloatingFrames;
+    int m_nListItems;
 
     /// the names corresponding to the DOCINFO field subtypes INFO[1-4]
     OUString m_InfoNames[4];

Reply via email to