[Libreoffice-commits] core.git: editeng/source sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Jun 20 16:21:14 UTC 2021


 editeng/source/rtf/svxrtf.cxx    |    5 +++++
 sc/source/filter/excel/excel.cxx |   14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit f2bcf8f5b383232a4f9f345b94f4b40b646edb22
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jun 20 14:55:34 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jun 20 18:20:36 2021 +0200

    ofz#24932 Timeout
    
    Change-Id: I3251824ac2613ac7fd994f66effb8be26aa8a7ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117512
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index fe1f18adcb0d..8bde87443c49 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -27,6 +27,7 @@
 #include <svl/itempool.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <tools/debug.hxx>
+#include <unotools/configmgr.hxx>
 
 #include <comphelper/string.hxx>
 
@@ -633,6 +634,10 @@ SvxRTFItemStackType* SvxRTFParser::GetAttrSet_()
     xNew->SetRTFDefaults( GetRTFDefaults() );
 
     aAttrStack.push_back( std::move(xNew) );
+
+    if (aAttrStack.size() > 1024 && utl::ConfigManager::IsFuzzing())
+        throw std::range_error("ecStackOverflow");
+
     bNewGroup = false;
     return aAttrStack.back().get();
 }
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index b3bd251fff82..2a42a7df2819 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -425,7 +425,19 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportCalcRTF(SvStream &rStream)
     aDocument.EnableExecuteLink(false);
     aDocument.SetInsertingFromOtherDoc(true);
     ScRange aRange;
-    return ScFormatFilter::Get().ScImportRTF(rStream, OUString(), &aDocument, aRange) == ERRCODE_NONE;
+
+    bool bRet;
+
+    try
+    {
+        bRet = ScFormatFilter::Get().ScImportRTF(rStream, OUString(), &aDocument, aRange) == ERRCODE_NONE;
+    }
+    catch (const std::range_error&)
+    {
+        return false;
+    }
+
+    return bRet;
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportXLS(SvStream& rStream)


More information about the Libreoffice-commits mailing list