diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-10-29 15:52:34 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-10-30 09:49:22 +0100 |
commit | 9b1e3e9bfdc0639630a367e45e4bdc2e9f22e503 (patch) | |
tree | 692c25b5055c29fe148518ab19a48bc038b948b0 | |
parent | fddfbeff8a8989a1e8852d77f69f834c79eff62f (diff) |
sw: UNO API: do not allow inserting control characters into nodes
Refuse invalid input in DocInsertStringSplitCR().
Change-Id: I097c1b3a1f70b0cf1fa3fc33fc1d965ee6c96280
Reviewed-on: https://gerrit.libreoffice.org/81696
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 05bab4a0c344..5e973c2b7c99 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -68,6 +68,7 @@ #include <cntfrm.hxx> #include <pagefrm.hxx> #include <svl/eitem.hxx> +#include <svl/lngmisc.hxx> #include <docary.hxx> #include <swtable.hxx> #include <tox.hxx> @@ -1105,6 +1106,17 @@ bool DocInsertStringSplitCR( { bool bOK = true; + for (sal_Int32 i = 0; i < rText.getLength(); ++i) + { + sal_Unicode const ch(rText[i]); + if (linguistic::IsControlChar(ch) + && ch != '\r' && ch != '\n' && ch != '\t') + { + SAL_WARN("sw.uno", "DocInsertStringSplitCR: refusing to insert control character " << int(ch)); + return false; + } + } + const SwInsertFlags nInsertFlags = bForceExpandHints ? ( SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) |