diff options
author | Eike Rathke <erack@redhat.com> | 2015-03-30 21:29:46 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-03-31 08:29:26 +0000 |
commit | 2c398d1b669551352d8916e792447ec6e495e9c1 (patch) | |
tree | edd2e0e1f821eb85b5c587f54d77bf644650f8cc | |
parent | 96e48976d25fb32d31fa5a128cfb3de103260576 (diff) |
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@redhat.com>
Reviewed-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | formula/source/ui/dlg/FormulaHelper.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx index 6c999bdea0bb..9d9bda1e4fc6 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 |