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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 20 20:53:45 UTC 2021


 starmath/source/cfgitem.cxx |    8 +++++++-
 starmath/source/parse.cxx   |    3 +--
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit aac0412d549ec6a2763a2beee1fdb24b501c6982
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Feb 20 19:51:32 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Feb 20 21:52:59 2021 +0100

    ofz#31177 avoid config layer for fuzzing
    
    Change-Id: Id476c3075ed20e97e93ea58813007941bd090027
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111263
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 34dbdebba656..8b9739ac14b9 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -26,6 +26,7 @@
 #include <svl/itempool.hxx>
 #include <svl/eitem.hxx>
 #include <svl/languageoptions.hxx>
+#include <unotools/configmgr.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
@@ -138,12 +139,13 @@ struct SmCfgOther
     SmCfgOther();
 };
 
+constexpr sal_uInt16 nDefaultSmSyntaxVersion(5);
 
 SmCfgOther::SmCfgOther()
     : ePrintSize(PRINT_SIZE_NORMAL)
     , nPrintZoomFactor(100)
     // Defaulted as 5 so I have time to code the parser 6
-    , nSmSyntaxVersion(5)
+    , nSmSyntaxVersion(nDefaultSmSyntaxVersion)
     , bPrintTitle(true)
     , bPrintFormulaText(true)
     , bPrintFrame(true)
@@ -1117,6 +1119,8 @@ bool SmMathConfig::IsAutoCloseBrackets() const
 
 sal_uInt16 SmMathConfig::GetDefaultSmSyntaxVersion() const
 {
+    if (utl::ConfigManager::IsFuzzing())
+        return nDefaultSmSyntaxVersion;
     if (!pOther)
         const_cast<SmMathConfig*>(this)->LoadOther();
     return pOther->nSmSyntaxVersion;
@@ -1166,6 +1170,8 @@ void SmMathConfig::SetDefaultSmSyntaxVersion( sal_uInt16 nVal )
 
 bool SmMathConfig::IsIgnoreSpacesRight() const
 {
+    if (utl::ConfigManager::IsFuzzing())
+        return false;
     if (!pOther)
         const_cast<SmMathConfig*>(this)->LoadOther();
     return pOther->bIgnoreSpacesRight;
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 3a9ad138e409..1de0a0518eef 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -23,7 +23,6 @@
 #include <com/sun/star/i18n/KParseType.hpp>
 #include <i18nlangtag/lang.h>
 #include <tools/lineend.hxx>
-#include <unotools/configmgr.hxx>
 #include <unotools/syslocale.hxx>
 #include <sal/log.hxx>
 #include <osl/diagnose.h>
@@ -1570,7 +1569,7 @@ std::unique_ptr<SmBlankNode> SmParser::DoBlank()
 
     // Ignore trailing spaces, if corresponding option is set
     if ( m_aCurToken.eType == TNEWLINE ||
-             (m_aCurToken.eType == TEND && !utl::ConfigManager::IsFuzzing() && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) )
+             (m_aCurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) )
     {
         pBlankNode->Clear();
     }


More information about the Libreoffice-commits mailing list