summaryrefslogtreecommitdiff
path: root/starmath/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-20 19:51:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-02-20 21:52:59 +0100
commitaac0412d549ec6a2763a2beee1fdb24b501c6982 (patch)
tree97fb2adec732a5801a3b500eb9bb654bbb160e69 /starmath/source
parentd49277fc7c017c5a62a0c28af782cfc04a6460ab (diff)
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@redhat.com>
Diffstat (limited to 'starmath/source')
-rw-r--r--starmath/source/cfgitem.cxx8
-rw-r--r--starmath/source/parse.cxx3
2 files changed, 8 insertions, 3 deletions
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();
}