[Libreoffice-commits] core.git: formula/source
Eike Rathke (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 12 22:35:25 UTC 2020
formula/source/ui/dlg/FormulaHelper.cxx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit f9790da286f2d2fa47f1748f8cfa6172c6622ca3
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Tue May 12 23:49:46 2020 +0200
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Wed May 13 00:34:47 2020 +0200
Check maximum end position to not assert() or "!!br0ken!!"
While editing a formula in the Function Wizard it could happen
that inserting an unclosed quote attempted to copy one more
character than string length for parameter display. For example
=FUNC("A";")
Change-Id: Ic25ee0b97c3baee8d2e964c9e4b907415b0d889e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94086
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx
index 9dbc5d8f7b80..5604c315b7f7 100644
--- a/formula/source/ui/dlg/FormulaHelper.cxx
+++ b/formula/source/ui/dlg/FormulaHelper.cxx
@@ -351,7 +351,9 @@ sal_Int32 FormulaHelper::GetFunctionEnd( const OUString& rStr, sal_Int32 nStart
nStart++; // Set behind found position
}
- return nStart;
+ // nStart > nStrLen can happen if there was an unclosed quote; instead of
+ // checking that in every loop iteration check it once here.
+ return std::min(nStart, nStrLen);
}
More information about the Libreoffice-commits
mailing list