xmloff/source/text/XMLTextFrameContext.cxx      |    4 +++-
 xmloff/source/text/XMLTextShapeImportHelper.cxx |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 9122c6f9b4c6901ea0cedf6e655daa1afbb57ab3
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Jan 2 12:58:13 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Jan 2 15:58:29 2024 +0100

    ofz#65464 Timeout with text:anchor-page-number="28031970720"
    
    text:anchor-page-number is problematic, possibly more so since
    
    commit 23eadd873de2e56d1e5f866fefae25c648f302f9
    Date:   Wed Jun 28 17:19:02 2023 +0200
    
        tdf#156077 sw: layout: call AssertFlyPages() in Init()
    
    in that missing pages are added to get to the page the object
    claims to be anchored to, to a max of 32767
    
    Limit this to 100 like:
    
    commit e4ee999d6d9c10ee10d6778eca9354d8fbaa720f
    Date:   Sun Jul 23 21:34:23 2023 +0100
    
        ofz#60533 Timeout with fo:font-size="842pt"
    
    when fuzzing to get reasonable performance
    
    Change-Id: Ic7568fe9535bdd07557434c8b51c1532415822a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161542
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index b00b2b84d90e..0ee7dcb7863b 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -22,6 +22,7 @@
 #include <sal/log.hxx>
 #include <comphelper/diagnose_ex.hxx>
 #include <comphelper/base64.hxx>
+#include <comphelper/configuration.hxx>
 #include <comphelper/mediamimetype.hxx>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -896,7 +897,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
         case XML_ELEMENT(TEXT, XML_ANCHOR_PAGE_NUMBER):
             {
                 sal_Int32 nTmp;
-                if (::sax::Converter::convertNumber(nTmp, aIter.toView(), 1, 
SHRT_MAX))
+                sal_Int32 nMax = !comphelper::IsFuzzing() ? SHRT_MAX : 100;
+                if (::sax::Converter::convertNumber(nTmp, aIter.toView(), 1, 
nMax))
                     nPage = static_cast<sal_Int16>(nTmp);
             }
             break;
diff --git a/xmloff/source/text/XMLTextShapeImportHelper.cxx 
b/xmloff/source/text/XMLTextShapeImportHelper.cxx
index aba039095a4d..314d394cc235 100644
--- a/xmloff/source/text/XMLTextShapeImportHelper.cxx
+++ b/xmloff/source/text/XMLTextShapeImportHelper.cxx
@@ -19,6 +19,7 @@
 
 #include <com/sun/star/text/XTextContent.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <comphelper/configuration.hxx>
 
 #include <sax/tools/converter.hxx>
 
@@ -103,7 +104,8 @@ void XMLTextShapeImportHelper::addShape(
         case XML_ELEMENT(TEXT, XML_ANCHOR_PAGE_NUMBER):
             {
                 sal_Int32 nTmp;
-                if (::sax::Converter::convertNumber(nTmp, aIter.toView(), 1, 
SHRT_MAX))
+                sal_Int32 nMax = !comphelper::IsFuzzing() ? SHRT_MAX : 100;
+                if (::sax::Converter::convertNumber(nTmp, aIter.toView(), 1, 
nMax))
                     nPage = static_cast<sal_Int16>(nTmp);
             }
             break;

Reply via email to