summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-10-25 22:31:57 +0200
committerEike Rathke <erack@redhat.com>2018-10-26 01:26:09 +0200
commitadbff0473751cde45e24bc06d524e858c68cc423 (patch)
treeb6f763e967643ff8fad15058b67aea2d42008042 /sc
parenta03528713a7a035bf0f9149801b5da9c14633c24 (diff)
Introduce kScInterpreterMaxStrLen
... and use that instead of SAL_MAX_UINT16 where string operations are involved. Change-Id: I41248bc1a876c19cd917269e44a6e91f51e569f5 Reviewed-on: https://gerrit.libreoffice.org/62373 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/inc/interpre.hxx8
-rw-r--r--sc/source/core/tool/interpr1.cxx2
2 files changed, 6 insertions, 4 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 3fb531e3d236..f63cdced71b9 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -91,6 +91,8 @@ class SharedStringPool;
}
+constexpr sal_Int32 kScInterpreterMaxStrLen = SAL_MAX_UINT16;
+
#define MAXSTACK (4096 / sizeof(formula::FormulaToken*))
class ScTokenStack
@@ -1079,9 +1081,9 @@ inline bool ScInterpreter::CheckStringPositionArgument( double & fVal )
fVal = 0.0;
return false;
}
- else if (fVal > SAL_MAX_UINT16)
+ else if (fVal > kScInterpreterMaxStrLen)
{
- fVal = static_cast<double>(SAL_MAX_UINT16);
+ fVal = static_cast<double>(kScInterpreterMaxStrLen);
return false;
}
return true;
@@ -1100,7 +1102,7 @@ inline sal_Int32 ScInterpreter::GetStringPositionArgument()
inline bool ScInterpreter::CheckStringResultLen( OUString& rResult, const OUString& rAdd )
{
- if ( rResult.getLength() + rAdd.getLength() > SAL_MAX_UINT16 )
+ if ( rResult.getLength() + rAdd.getLength() > kScInterpreterMaxStrLen )
{
SetError( FormulaError::StringOverflow );
rResult.clear();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 11fe25e89822..e6de3b6041ef 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -9430,7 +9430,7 @@ void ScInterpreter::ScRept()
OUString aStr = GetString().getString();
if (nCnt < 0)
PushIllegalArgument();
- else if (static_cast<double>(nCnt) * aStr.getLength() > SAL_MAX_UINT16)
+ else if (static_cast<double>(nCnt) * aStr.getLength() > kScInterpreterMaxStrLen)
{
PushError( FormulaError::StringOverflow );
}