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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 25 23:27:31 UTC 2018


 sc/source/core/inc/interpre.hxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 28cc9746a9639ac14d3f6816b7fbf59cacbb42f4
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Oct 25 22:48:03 2018 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Fri Oct 26 01:27:00 2018 +0200

    Change kScInterpreterMaxStrLen now result string length limit to 256MB
    
    This is arbitrary.
    
    Change-Id: I88875e674464984c174e27fa6038080cc7366ecf
    Reviewed-on: https://gerrit.libreoffice.org/62375
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 85f96435ba9a..c7bcfb9a7d91 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -91,7 +91,8 @@ class SharedStringPool;
 
 }
 
-constexpr sal_Int32 kScInterpreterMaxStrLen = SAL_MAX_UINT16;
+/// Arbitrary 256MB result string length limit.
+constexpr sal_Int32 kScInterpreterMaxStrLen = SAL_MAX_INT32 / 8;
 
 #define MAXSTACK      (4096 / sizeof(formula::FormulaToken*))
 
@@ -1102,7 +1103,7 @@ inline sal_Int32 ScInterpreter::GetStringPositionArgument()
 
 inline bool ScInterpreter::CheckStringResultLen( OUString& rResult, const OUString& rAdd )
 {
-    if ( rResult.getLength() + rAdd.getLength() > kScInterpreterMaxStrLen )
+    if (rAdd.getLength() > kScInterpreterMaxStrLen - rResult.getLength())
     {
         SetError( FormulaError::StringOverflow );
         rResult.clear();


More information about the Libreoffice-commits mailing list