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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 9 11:25:26 UTC 2020


 sc/source/ui/docshell/impex.cxx |   28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 39e502a99c5eba6249ffaf0e7376c431d3e24fe3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Sep 9 10:39:19 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 9 13:24:42 2020 +0200

    ofz#21213 avoid Timeout when fuzzing
    
    Change-Id: I095ac9e2e07d2b5a2dc5da7cff09fdbfcfb08839
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102291
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 68cbfedfb4fc..98b65f929346 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2041,17 +2041,29 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
                 if ( bData && *p == ';' && *(p+1) == 'P' )
                 {
                     OUString aCode( p+2 );
-                    // unescape doubled semicolons
-                    aCode = aCode.replaceAll(";;", ";");
-                    // get rid of Xcl escape characters
-                    aCode = aCode.replaceAll("\x1b", "");
-                    sal_Int32 nCheckPos;
-                    SvNumFormatType nType;
+
                     sal_uInt32 nKey;
-                    pDoc->GetFormatTable()->PutandConvertEntry( aCode, nCheckPos, nType, nKey,
-                                                                LANGUAGE_ENGLISH_US, ScGlobal::eLnge, false);
+                    sal_Int32 nCheckPos;
+
+                    if (aCode.getLength() > 2048 && utl::ConfigManager::IsFuzzing())
+                    {
+                        // consider an excessive length as a failure when fuzzing
+                        nCheckPos = 1;
+                    }
+                    else
+                    {
+                        // unescape doubled semicolons
+                        aCode = aCode.replaceAll(";;", ";");
+                        // get rid of Xcl escape characters
+                        aCode = aCode.replaceAll("\x1b", "");
+                        SvNumFormatType nType;
+                        pDoc->GetFormatTable()->PutandConvertEntry( aCode, nCheckPos, nType, nKey,
+                                                                    LANGUAGE_ENGLISH_US, ScGlobal::eLnge, false);
+                    }
+
                     if ( nCheckPos )
                         nKey = 0;
+
                     aFormats.push_back( nKey );
                 }
             }


More information about the Libreoffice-commits mailing list