summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-10-29 15:52:34 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-04-09 23:22:08 +0200
commit69241f0db4c569afe77fad4da79159e71740fd2d (patch)
treec40d2374de9946564b406b434bb0351a239602ba
parentofz#26122 allow NINSIZE input full elements (diff)
downloadcore-69241f0db4c569afe77fad4da79159e71740fd2d.tar.gz
core-69241f0db4c569afe77fad4da79159e71740fd2d.zip
sw: UNO API: do not allow inserting control characters into nodes
Refuse invalid input in DocInsertStringSplitCR(). Reviewed-on: https://gerrit.libreoffice.org/81696 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 9b1e3e9bfdc0639630a367e45e4bdc2e9f22e503) Change-Id: I097c1b3a1f70b0cf1fa3fc33fc1d965ee6c96280
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 7581c46b16e9..093ad9463a5f 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>
@@ -1108,6 +1109,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)