[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - formula/source

Eike Rathke erack at redhat.com
Tue Mar 31 01:29:54 PDT 2015


 formula/source/ui/dlg/FormulaHelper.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 2c398d1b669551352d8916e792447ec6e495e9c1
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Mar 30 21:29:46 2015 +0200

    Resolves: tdf#90301 string access out of bounds
    
    Apparently yet another leftover of UniString to OUString conversion
    where with UniString out-of-bounds accesses didn't harm and returned
    NIL.
    
    (cherry picked from commit eed393039a9067f7a1a318934ff1c5ff90bfe443)
    
    Include <algorithm> for std::min()
    
    (cherry picked from commit 3394ac816a573030feda145dbdabd2a1eabd78c4)
    
    Change-Id: Id88456a52df3fc8cdaf90d9d509e327b96269808
    13ed47d23ed4b94501d9445555d99ce08af94698
    Reviewed-on: https://gerrit.libreoffice.org/15075
    Tested-by: David Tardon <dtardon at redhat.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx
index 6c999bd..9d9bda1 100644
--- a/formula/source/ui/dlg/FormulaHelper.cxx
+++ b/formula/source/ui/dlg/FormulaHelper.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <algorithm>
+
 #include "formula/formulahelper.hxx"
 #include <unotools/charclass.hxx>
 #include <unotools/syslocale.hxx>
@@ -201,7 +203,7 @@ sal_Int32 FormulaHelper::GetFunctionStart( const OUString&   rFormula,
         return nStart;
 
     sal_Int32  nFStart = FUNC_NOTFOUND;
-    sal_Int32  nParPos = nStart;
+    sal_Int32  nParPos = bBack ? ::std::min( nStart, nStrLen - 1) : nStart;
 
     bool bRepeat, bFound;
     do


More information about the Libreoffice-commits mailing list