From aac0412d549ec6a2763a2beee1fdb24b501c6982 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 20 Feb 2021 19:51:32 +0000 Subject: ofz#31177 avoid config layer for fuzzing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id476c3075ed20e97e93ea58813007941bd090027 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111263 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- starmath/source/cfgitem.cxx | 8 +++++++- starmath/source/parse.cxx | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'starmath') 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 #include #include +#include #include #include #include @@ -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(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(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 #include #include -#include #include #include #include @@ -1570,7 +1569,7 @@ std::unique_ptr 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(); } -- cgit