summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8par5.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-11-12 18:57:58 +0100
committerVasily Melenchuk <vasily.melenchuk@cib.de>2021-04-13 15:55:06 +0300
commitc0fd4549d478350bdbdd75a070be013066588e71 (patch)
tree47d701d6e406a37e4412e100276ab966b2b6d016 /sw/source/filter/ww8/ww8par5.cxx
parent0f7130769d3e6578c4cd718ed8823c0e1a821dd8 (diff)
ofz#18526 sw: WW8 import: don't insert control characters
Sanitize string before calling InsertString(). This segfaults since: commit b522fc0646915d4da94df38dd249c88b28f25be7 Date: Tue Sep 24 18:11:45 2019 +0200 sw: maintain fieldmarks in DeleteRange()/DeleteAndJoin()/ReplaceRange() Change-Id: I9ef73d924420686f6838fa21900ec57b4d25c905 Reviewed-on: https://gerrit.libreoffice.org/81949 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 7ecda38cdaa2361e8510bf3e7206863c4936deab) Reviewed-on: https://gerrit.libreoffice.org/82759 (cherry picked from commit d494a4c0ead7db481757d8d67fbce9e1b02e65df)
Diffstat (limited to 'sw/source/filter/ww8/ww8par5.cxx')
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 1d2430db8d69..963364531d19 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -34,6 +34,7 @@
#include <svl/urihelper.hxx>
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
+#include <svl/lngmisc.hxx>
#include <sfx2/linkmgr.hxx>
#include <rtl/character.hxx>
#include <unotools/charclass.hxx>
@@ -1906,7 +1907,8 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, OUString& rStr )
if( aQ.isEmpty() )
return eF_ResT::TAGIGN; // -> no 0-char in text
- if (sal_Unicode cChar = static_cast<sal_Unicode>(aQ.toInt32()))
+ sal_Unicode const cChar = static_cast<sal_Unicode>(aQ.toInt32());
+ if (!linguistic::IsControlChar(cChar) || cChar == '\r' || cChar == '\n' || cChar == '\t')
{
if (!aName.isEmpty()) // Font Name set ?
{
@@ -2686,11 +2688,11 @@ void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam)
if ((nBegin != -1) && (nEnd != -1) && (nBegin < nEnd))
{
sText = sPart.copy(nBegin+1,nEnd-nBegin-1);
+ sText = sw::FilterControlChars(sText);
}
}
}
}
-
}
break;
}