summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--writerfilter/CppunitTest_writerfilter_rtftok.mk83
-rw-r--r--writerfilter/Module_writerfilter.mk1
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2005-2971-1.rtf11
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2010-3451-1.rtf17
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2964.rtf11
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-1.rtf57
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-2.rtf57
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2007-0245-1.rtf21
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3333-1.rtfbin0 -> 11289 bytes
-rw-r--r--writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3452-1.rtf1
-rw-r--r--writerfilter/qa/cppunittests/rtftok/testrtftok.cxx173
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx14
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx9
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx12
-rw-r--r--writerfilter/source/dmapper/SettingsTable.cxx3
-rw-r--r--writerfilter/source/filter/RtfFilter.cxx36
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx33
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx18
-rw-r--r--writerfilter/source/rtftok/rtftokenizer.cxx4
20 files changed, 519 insertions, 50 deletions
diff --git a/writerfilter/CppunitTest_writerfilter_rtftok.mk b/writerfilter/CppunitTest_writerfilter_rtftok.mk
new file mode 100644
index 000000000..441287b96
--- /dev/null
+++ b/writerfilter/CppunitTest_writerfilter_rtftok.mk
@@ -0,0 +1,83 @@
+# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Miklos Vajna <vmiklos@frugalware.org>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,writerfilter_rtftok))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_rtftok, \
+ writerfilter/qa/cppunittests/rtftok/testrtftok \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,writerfilter_rtftok, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ ucbhelper \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_add_api,writerfilter_rtftok,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,writerfilter_rtftok))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,writerfilter_rtftok,\
+ types \
+))
+
+$(eval $(call gb_CppunitTest_add_service_rdbs,writerfilter_rtftok,\
+ writerfilter_rtftok \
+))
+
+$(eval $(call gb_CppunitTest_set_args,writerfilter_rtftok,\
+ --headless \
+ --invisible \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+))
+
+$(eval $(call gb_RdbTarget_RdbTarget,writerfilter_rtftok))
+
+$(eval $(call gb_RdbTarget_add_components,writerfilter_rtftok,\
+ writerfilter/util/writerfilter \
+))
+
+$(eval $(call gb_RdbTarget_add_old_components,writerfilter_rtftok,\
+ ucb1 \
+ ucpfile1 \
+))
+
+# we need to explicitly depend on library rtftok because it is not implied
+# by a link relation
+$(call gb_CppunitTest_get_target,writerfilter_rtftok) : $(call gb_Library_get_target,rtftok)
+
+# vim: set noet sw=4 ts=4:
diff --git a/writerfilter/Module_writerfilter.mk b/writerfilter/Module_writerfilter.mk
index 22ece10d6..92d0ab565 100644
--- a/writerfilter/Module_writerfilter.mk
+++ b/writerfilter/Module_writerfilter.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_Module_add_targets,writerfilter,\
$(eval $(call gb_Module_add_check_targets,writerfilter,\
CppunitTest_writerfilter_doctok \
+ CppunitTest_writerfilter_rtftok \
))
$(eval $(call gb_Module_add_subsequentcheck_targets,writerfilter,\
diff --git a/writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2005-2971-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2005-2971-1.rtf
new file mode 100644
index 000000000..7ed841f88
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2005-2971-1.rtf
@@ -0,0 +1,11 @@
+{\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1\ansi\deff0\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Nimbus Roman No9 L;}}
+{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
+{\stylesheet{\s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033\snext1 Default;}
+}
+{\info{\comment StarWriter}{\vern6410}}\deftab1250
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\pgdscnxt0 Default;}}
+\paperh15840\paperw12240\margl1800\margr1800\margt1440\margb1440\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\pard\plain \s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033 {\ltrch\loch\f0 hello}
+\par }
diff --git a/writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2010-3451-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2010-3451-1.rtf
new file mode 100644
index 000000000..5cc06e862
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/fail/CVE-2010-3451-1.rtf
@@ -0,0 +1,17 @@
+{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1031\deflangfe1031{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
+{\f35\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f36\froman\fcharset238\fprq2 Times New Roman CE;}{\f37\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f39\froman\fcharset161\fprq2 Times New Roman Greek;}
+{\f40\froman\fcharset162\fprq2 Times New Roman Tur;}{\f41\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f42\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f43\froman\fcharset186\fprq2 Times New Roman Baltic;}
+{\f44\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f46\fswiss\fcharset238\fprq2 Arial CE;}{\f47\fswiss\fcharset204\fprq2 Arial Cyr;}{\f49\fswiss\fcharset161\fprq2 Arial Greek;}{\f50\fswiss\fcharset162\fprq2 Arial Tur;}
+{\f51\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f52\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f53\fswiss\fcharset186\fprq2 Arial Baltic;}{\f54\fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f386\fswiss\fcharset238\fprq2 Tahoma CE;}
+{\f387\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f389\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f390\fswiss\fcharset162\fprq2 Tahoma Tur;}{\f391\fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f392\fswiss\fcharset178\fprq2 Tahoma (Arabic);}
+{\f393\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f394\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f395\fswiss\fcharset222\fprq2 Tahoma (Thai);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
+\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
+\red192\green192\blue192;\red255\green255\blue255;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 \snext0 Normal;}{\*\cs10 \additive \ssemihidden
+Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \cbpat9
+\f35\fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 \sbasedon0 \snext15 \ssemihidden \styrsid15755787 Document Map;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\revtbl {Unknown;}}{\*\rsidtbl \rsid15755787}{\*\generator Microsoft Word 11.0.5604;}{\info
+{\title Report title}{\author CA-RET}{\operator Heidrun}{\creatim\yr2007\mo9\dy25\hr11\min47}{\revtim\yr2007\mo9\dy25\hr11\min47}{\version2}{\edmins0}{\nofpages9}{\nofwords3088}{\nofchars19458}{\*\company TRFV}{\nofcharsws22501}{\vern24689}}
+\paperw11909\paperh16834\margl854\margr567\margt850\margb850 \widowctrl\ftnbj\aenddoc\hyphhotz425\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3
+\jcompress\viewkind1\viewscale100\nolnhtadjtbl\rsidroot15755787 \fet0\sectd \linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3
+\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
+{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2964.rtf b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2964.rtf
new file mode 100644
index 000000000..bf61eeade
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2964.rtf
@@ -0,0 +1,11 @@
+{\rtf1\ansi\deff0\adeflang1025
+{\fonttbl{\f0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfroman\fprq2\fcharset0 Nimbus Roman No9 L;}}
+{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
+{\stylesheet{\s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033\snext1 Default;}
+}
+{\info{\comment StarWriter}{\vern6410}}\deftab1250
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\pgdscnxt0 Default;}}
+\paperh15840\paperw12240\margl1800\margr1800\margt1440\margb1440\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\pard\plain \s1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs24\lang255\ltrch\dbch\af2\afs24\langfe255\loch\f0\fs24\lang1033 {\ltrch\loch\f0 hello}
+\par }
diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-1.rtf
new file mode 100644
index 000000000..c38d6fc64
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-1.rtf
@@ -0,0 +1,57 @@
+{\rtf1\ansi\ansicpg1252\deff0
+{\fonttbl
+{\f0\fnil\fcharset0\fprq0\fttruetype Times New Roman;}
+{\f1\fnil\fcharset0\fprq0\fttruetype Nimbus Sans L;}
+{\f2\fnil\fcharset0\fprq0\fttruetype Dingbats;}
+{\f3\fnil\fcharset0\fprq0\fttruetype Symbol;}
+{\f4\fnil\fcharset0\fprq0\fttruetype Courier New;}}
+{\colortbl
+\red0\green0\blue0;
+\red255\green255\blue255;}
+{\stylesheet
+{\s1\fi-431\li720\sbasedon28\snext28 Contents 1;}
+{\s2\fi-431\li1440\sbasedon28\snext28 Contents 2;}
+{\s3\fi-431\li2160\sbasedon28\snext28 Contents 3;}
+{\s8\fi-431\li720\sbasedon28 Lower Roman List;}
+{\s5\tx431\sbasedon24\snext28 Numbered Heading 1;}
+{\s6\tx431\sbasedon25\snext28 Numbered Heading 2;}
+{\s7\fi-431\li720 Square List;}
+{\*\cs11\sbasedon28 Endnote Text;}
+{\s4\fi-431\li2880\sbasedon28\snext28 Contents 4;}
+{\s9\fi-431\li720 Diamond List;}
+{\s10\fi-431\li720 Numbered List;}
+{\*\cs12\fs20\super Endnote Reference;}
+{\s13\fi-431\li720 Triangle List;}
+{\s14\tx431\sbasedon26\snext28 Numbered Heading 3;}
+{\s15\fi-431\li720 Dashed List;}
+{\s16\fi-431\li720\sbasedon10 Upper Roman List;}
+{\s17\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 4;}
+{\s18\fi-431\li720 Heart List;}
+{\s34\fi-431\li720 Box List;}
+{\s20\fi-431\li720\sbasedon10 Upper Case List;}
+{\s21\fi-431\li720 Bullet List;}
+{\s22\fi-431\li720 Hand List;}
+{\*\cs23\fs20\sbasedon28 Footnote Text;}
+{\s24\sb440\sa60\f1\fs34\b\sbasedon28\snext28 Heading 1;}
+{\s25\sb440\sa60\f1\fs28\b\sbasedon28\snext28 Heading 2;}
+{\s19\qc\sb240\sa120\f1\fs32\b\sbasedon28\snext28 Contents Header;}
+{\s27\fi-431\li720 Tick List;}
+{\s26\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 3;}
+{\s29\fi-431\li720\sbasedon10 Lower Case List;}
+{\s30\li1440\ri1440\sa120\sbasedon28 Block Text;}
+{\s36\f4\sbasedon28 Plain Text;}
+{\s32\tx1584\sbasedon5\snext28 Section Heading;}
+{\s33\fi-431\li720 Implies List;}
+{\s28\f0\fs24\lang1033 Normal;}
+{\s35\fi-431\li720 Star List;}
+{\*\cs31\fs20\super Footnote Reference;}
+{\s37\tx1584\sbasedon5\snext28 Chapter Heading;}}
+{\*\listtable
+{\list\listtemplateid1002\listsimple{\listlevel\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}}\listid1000}}
+{\*\listoverridetable
+{\listoverride\listoverridecount0\listid1000\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}\ls1}}
+
+\kerning0\cf0\ftnbj\fet2\ftnstart1\ftnnar\aftnnar\ftnstart1\aftnstart1\aenddoc\facingp\titlepg\revprop3{\info}\deftab720\viewkind1\paperw12240\paperh15840\margl1440\margr1440\widowctl
+\sectd\sbknone\colsx360\pgncont\ltrsect
+{\listtext\pard\fi-431\li720 1. }\pard\plain{\ltrpar\ql\fi-431\li720\s28{\*\abilist\abilistid1000\abilistparentid0\abilistlevel1\abistartat1{\abifieldfont NULL}{\abilistdecimal .}{\abilistdelim %L.}{\abiliststyle Numbered List}}{\*\pn\pnql\pnstart1\pnlvlbody\pndec{\pntxtb AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA}{\pntxta .}}\fn-431\li720\ls1\ilvl0\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\abinodiroverride\ltrch test}{\s28\f0\fs24\lang1033{\*\listtag1001}\par}
+}\pard\plain\ltrpar\ql\s28\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\par}}
diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-2.rtf b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-2.rtf
new file mode 100644
index 000000000..2a3f782b7
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2005-2972-2.rtf
@@ -0,0 +1,57 @@
+{\rtf1\ansi\ansicpg1252\deff0
+{\fonttbl
+{\f0\fnil\fcharset0\fprq0\fttruetype Times New Roman;}
+{\f1\fnil\fcharset0\fprq0\fttruetype Nimbus Sans L;}
+{\f2\fnil\fcharset0\fprq0\fttruetype Dingbats;}
+{\f3\fnil\fcharset0\fprq0\fttruetype Symbol;}
+{\f4\fnil\fcharset0\fprq0\fttruetype Courier New;}}
+{\colortbl
+\red0\green0\blue0;
+\red255\green255\blue255;}
+{\stylesheet
+{\s1\fi-431\li720\sbasedon28\snext28 Contents 1;}
+{\s2\fi-431\li1440\sbasedon28\snext28 Contents 2;}
+{\s3\fi-431\li2160\sbasedon28\snext28 Contents 3;}
+{\s8\fi-431\li720\sbasedon28 Lower Roman List;}
+{\s5\tx431\sbasedon24\snext28 Numbered Heading 1;}
+{\s6\tx431\sbasedon25\snext28 Numbered Heading 2;}
+{\s7\fi-431\li720 Square List;}
+{\*\cs11\sbasedon28 Endnote Text;}
+{\s4\fi-431\li2880\sbasedon28\snext28 Contents 4;}
+{\s9\fi-431\li720 Diamond List;}
+{\s10\fi-431\li720 Numbered List;}
+{\*\cs12\fs20\super Endnote Reference;}
+{\s13\fi-431\li720 Triangle List;}
+{\s14\tx431\sbasedon26\snext28 Numbered Heading 3;}
+{\s15\fi-431\li720 Dashed List;}
+{\s16\fi-431\li720\sbasedon10 Upper Roman List;}
+{\s17\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 4;}
+{\s18\fi-431\li720 Heart List;}
+{\s34\fi-431\li720 Box List;}
+{\s20\fi-431\li720\sbasedon10 Upper Case List;}
+{\s21\fi-431\li720 Bullet List;}
+{\s22\fi-431\li720 Hand List;}
+{\*\cs23\fs20\sbasedon28 Footnote Text;}
+{\s24\sb440\sa60\f1\fs34\b\sbasedon28\snext28 Heading 1;}
+{\s25\sb440\sa60\f1\fs28\b\sbasedon28\snext28 Heading 2;}
+{\s19\qc\sb240\sa120\f1\fs32\b\sbasedon28\snext28 Contents Header;}
+{\s27\fi-431\li720 Tick List;}
+{\s26\sb440\sa60\f1\fs24\b\sbasedon28\snext28 Heading 3;}
+{\s29\fi-431\li720\sbasedon10 Lower Case List;}
+{\s30\li1440\ri1440\sa120\sbasedon28 Block Text;}
+{\s36\f4\sbasedon28 Plain Text;}
+{\s32\tx1584\sbasedon5\snext28 Section Heading;}
+{\s33\fi-431\li720 Implies List;}
+{\s28\f0\fs24\lang1033 Normal;}
+{\s35\fi-431\li720 Star List;}
+{\*\cs31\fs20\super Footnote Reference;}
+{\s37\tx1584\sbasedon5\snext28 Chapter Heading;}}
+{\*\listtable
+{\list\listtemplateid1002\listsimple{\listlevel\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}}\listid1000}}
+{\*\listoverridetable
+{\listoverride\listoverridecount0\listid1000\levelnfc0\levelstartat1\levelspace0\levelfollow0\fi-431\li720{\leveltext\'02\'00.;}{\levelnumbers\'01;}\ls1}}
+
+\kerning0\cf0\ftnbj\fet2\ftnstart1\ftnnar\aftnnar\ftnstart1\aftnstart1\aenddoc\facingp\titlepg\revprop3{\info}\deftab720\viewkind1\paperw12240\paperh15840\margl1440\margr1440\widowctl
+\sectd\sbknone\colsx360\pgncont\ltrsect
+{\listtext\pard\fi-431\li720 1. }\pard\plain{\ltrpar\ql\fi-431\li720\s28{\*\abilist\abilistid1000\abilistparentid0\abilistlevel1\abistartat1{\abifieldfont NULL}{\abilistdecimal .}{\abilistdelim %L.}{\abiliststyle AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANumbered List}}{\*\pn\pnql\pnstart1\pnlvlbody\pndec{\pntxtb }{\pntxta .}}\fn-431\li720\ls1\ilvl0\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\abinodiroverride\ltrch test}{\s28\f0\fs24\lang1033{\*\listtag1001}\par}
+}\pard\plain\ltrpar\ql\s28\itap0{\s28\f0\fs24\lang1033{\*\listtag0}\par}}
diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2007-0245-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2007-0245-1.rtf
new file mode 100644
index 000000000..a166c56e1
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2007-0245-1.rtf
@@ -0,0 +1,21 @@
+{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;}
+{\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\f43\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
+\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
+\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \snext0 Normal;}{\*\cs10 \additive \ssemihidden
+Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
+\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext15 \ssemihidden \styrsid4263288 footnote text;}{\*\cs16 \additive \super \sbasedon10 \ssemihidden \styrsid4263288 footnote reference;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}
+{\*\rsidtbl \rsid163671\rsid4263288\rsid7694566\rsid13791612\rsid15955330}{\*\generator Microsoft Word 11.0.6359;}{\info{\title }{\author John}{\operator John}{\version2}{\edmins1}
+{\nofpages1}{\nofwords0}{\nofchars1}{\*\company NGS}{\nofcharsws1}{\vern24703}}{\*\userprops {\propname _DocHome}\proptype3{\staticval -1428762290}}\paperw11906\paperh16838
+\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
+\jexpand\viewkind1\viewscale86\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
+\asianbrkrule\rsidroot163671\newtblstyruls\nogrowautofit \fet0{\*\ftnsep \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid4263288 \chftnsep
+\par }}{\*\ftnsepc \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid4263288 \chftnsepc
+\par }}{\*\aftnsep \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid4263288 \chftnsep
+\par }}{\*\aftnsepc \pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid4263288 \chftnsepc
+\par }}\sectd \linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3
+\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
+{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
+\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid163671 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\cs16\super\insrsid4263288 \chftn {\prtdata0 616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161}}{\insrsid13791612\charrsid163671
+\par }}
diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3333-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3333-1.rtf
new file mode 100644
index 000000000..aaf9acd99
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3333-1.rtf
Binary files differ
diff --git a/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3452-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3452-1.rtf
new file mode 100644
index 000000000..b2800b5ed
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/pass/CVE-2010-3452-1.rtf
@@ -0,0 +1 @@
+{\rtf1\ansi{\*\pnseclvlÿ}}
diff --git a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
new file mode 100644
index 000000000..7ed42dcdf
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Miklos Vajna <vmiklos@frugalware.org>
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <sal/cppunit.h>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+
+#include <vcl/svapp.hxx>
+#include <ucbhelper/contentbroker.hxx>
+
+using namespace ::com::sun::star;
+
+class RtfTest : public CppUnit::TestFixture
+{
+public:
+ RtfTest();
+ ~RtfTest();
+
+ virtual void setUp();
+ virtual void tearDown();
+
+ void recursiveScan(const rtl::OUString &rURL, bool bExpected);
+ bool load(const rtl::OUString &rURL);
+ void test();
+
+ CPPUNIT_TEST_SUITE(RtfTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+private:
+ uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference<lang::XMultiComponentFactory> m_xFactory;
+ uno::Reference<lang::XMultiServiceFactory> m_xMSF;
+ uno::Reference<document::XFilter> m_xFilter;
+
+ ::rtl::OUString m_aSrcRoot;
+ int m_nLoadedDocs;
+};
+
+RtfTest::RtfTest()
+ : m_aSrcRoot(RTL_CONSTASCII_USTRINGPARAM("file://")),
+ m_nLoadedDocs(0)
+{
+ m_xContext = cppu::defaultBootstrap_InitialComponentContext();
+ m_xFactory = m_xContext->getServiceManager();
+ m_xMSF = uno::Reference<lang::XMultiServiceFactory>(m_xFactory, uno::UNO_QUERY_THROW);
+ m_xFilter = uno::Reference< document::XFilter >(m_xMSF->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.RtfFilter"))),
+ uno::UNO_QUERY_THROW);
+
+ const char* pSrcRoot = getenv( "SRC_ROOT" );
+ CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0);
+
+#ifdef WNT
+ if (pSrcRoot[1] == ':')
+ m_aSrcRoot += rtl::OUString::createFromAscii( "/" );
+#endif
+ m_aSrcRoot += rtl::OUString::createFromAscii( pSrcRoot );
+
+ // Without these we're crashing
+ comphelper::setProcessServiceFactory(m_xMSF);
+ InitVCL(m_xMSF);
+
+ // initialise UCB-Broker
+ uno::Sequence<uno::Any> aUcbInitSequence(2);
+ aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local"));
+ aUcbInitSequence[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office"));
+ bool bInitUcb = ucbhelper::ContentBroker::initialize(m_xMSF, aUcbInitSequence);
+ CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb);
+
+ uno::Reference<ucb::XContentProviderManager> xUcb =
+ ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
+ uno::Reference<ucb::XContentProvider> xFileProvider(m_xMSF->createInstance(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY);
+ xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True);
+}
+
+RtfTest::~RtfTest()
+{
+ DeInitVCL();
+}
+
+void RtfTest::setUp()
+{
+}
+
+void RtfTest::tearDown()
+{
+}
+
+bool RtfTest::load(const rtl::OUString &rURL)
+{
+ ++m_nLoadedDocs;
+ uno::Sequence< beans::PropertyValue > aDescriptor(1);
+ aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
+ aDescriptor[0].Value <<= rURL;
+ return m_xFilter->filter(aDescriptor);
+}
+
+void RtfTest::recursiveScan(const rtl::OUString &rURL, bool bExpected)
+{
+ osl::Directory aDir(rURL);
+
+ CPPUNIT_ASSERT_MESSAGE("failed to open directory", osl::FileBase::E_None == aDir.open());
+ osl::DirectoryItem aItem;
+ osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
+ while (aDir.getNextItem(aItem) == osl::FileBase::E_None)
+ {
+ aItem.getFileStatus(aFileStatus);
+ rtl::OUString sURL = aFileStatus.getFileURL();
+ if (aFileStatus.getFileType() == osl::FileStatus::Directory)
+ recursiveScan(sURL, bExpected);
+ else
+ {
+ //ignore .files
+ sal_Int32 nLastSlash = sURL.lastIndexOf('/');
+ if ((nLastSlash != -1) && (nLastSlash+1 < sURL.getLength()) &&
+ (sURL.getStr()[nLastSlash+1] == '.'))
+ continue;
+
+ bool bRes = load(sURL);
+ rtl::OString aRes(rtl::OUStringToOString(sURL, osl_getThreadTextEncoding()));
+ CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == bExpected);
+ }
+ }
+ CPPUNIT_ASSERT_MESSAGE("failed to close directory", osl::FileBase::E_None == aDir.close());
+}
+
+void RtfTest::test()
+{
+ recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/filters/writerfilter/qa/cppunittests/rtftok/data/pass")), true);
+ recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/filters/writerfilter/qa/cppunittests/rtftok/data/fail")), false);
+
+ printf("Rtf: tested %d files\n", m_nLoadedDocs);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RtfTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index b4e1426f7..25c6e4d77 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -160,8 +160,12 @@ DomainMapper::~DomainMapper()
try
{
uno::Reference< text::XDocumentIndexesSupplier> xIndexesSupplier( m_pImpl->GetTextDocument(), uno::UNO_QUERY );
- uno::Reference< container::XIndexAccess > xIndexes = xIndexesSupplier->getDocumentIndexes();
- sal_Int32 nIndexes = xIndexes->getCount();
+ sal_Int32 nIndexes = 0;
+ if( xIndexesSupplier.is() )
+ {
+ uno::Reference< container::XIndexAccess > xIndexes = xIndexesSupplier->getDocumentIndexes();
+ nIndexes = xIndexes->getCount();
+ }
if( nIndexes )
{
//index update has to wait until first view is created
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 4ee042b2d..0df4bdbdc 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -708,12 +708,16 @@ void DomainMapperTableHandler::endTable()
{
try
{
- uno::Reference<text::XTextTable> xTable = m_xText->convertToTable(*m_pTableSeq,
- aCellProperties,
- aRowProperties,
- aTableInfo.aTableProperties);
+ if (m_xText.is())
+ {
+ uno::Reference<text::XTextTable> xTable = m_xText->convertToTable(*m_pTableSeq,
+ aCellProperties,
+ aRowProperties,
+ aTableInfo.aTableProperties);
- m_xTableRange = xTable->getAnchor( );
+ if (xTable.is())
+ m_xTableRange = xTable->getAnchor( );
+ }
}
catch (lang::IllegalArgumentException)
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 693b3dd00..2118d7eca 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -242,7 +242,8 @@ uno::Reference< container::XNameContainer > DomainMapper_Impl::GetPageStyles(
if(!m_xPageStyles.is())
{
uno::Reference< style::XStyleFamiliesSupplier > xSupplier( m_xTextDocument, uno::UNO_QUERY );
- xSupplier->getStyleFamilies()->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles"))) >>= m_xPageStyles;
+ if (xSupplier.is())
+ xSupplier->getStyleFamilies()->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles"))) >>= m_xPageStyles;
}
return m_xPageStyles;
}
@@ -260,7 +261,7 @@ uno::Reference< text::XText > DomainMapper_Impl::GetBodyText()
uno::Reference< beans::XPropertySet > DomainMapper_Impl::GetDocumentSettings()
{
- if( !m_xDocumentSettings.is() )
+ if( !m_xDocumentSettings.is() && m_xTextFactory.is())
{
m_xDocumentSettings = uno::Reference< beans::XPropertySet >(
m_xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings"))), uno::UNO_QUERY );
@@ -287,6 +288,8 @@ void DomainMapper_Impl::SetDocumentSettingsProperty( const ::rtl::OUString& rPro
void DomainMapper_Impl::RemoveLastParagraph( )
{
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
+ if (!xTextAppend.is())
+ return;
try
{
uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
@@ -3265,7 +3268,7 @@ void DomainMapper_Impl::ResetParaRedline( )
void DomainMapper_Impl::ApplySettingsTable()
{
- if( m_pSettingsTable )
+ if( m_pSettingsTable && m_xTextFactory.is() )
{
try
{
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 866a3a51e..bfe5cffc0 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -390,9 +390,10 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
m_aFirstPageStyle = uno::Reference< beans::XPropertySet > (
xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle") )),
uno::UNO_QUERY);
- xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) );
+ if (xPageStyles.is())
+ xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) );
}
- else if( !m_aFirstPageStyle.is() )
+ else if( !m_aFirstPageStyle.is() && xPageStyles.is() )
{
xPageStyles->getByName(m_sFirstPageStyleName) >>= m_aFirstPageStyle;
}
@@ -400,7 +401,7 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
}
else
{
- if( !m_sFollowPageStyleName.getLength() )
+ if( !m_sFollowPageStyleName.getLength() && xPageStyles.is() )
{
uno::Sequence< ::rtl::OUString > aPageStyleNames = xPageStyles->getElementNames();
m_sFollowPageStyleName = lcl_FindUnusedPageStyleName(aPageStyleNames);
@@ -409,7 +410,7 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
uno::UNO_QUERY);
xPageStyles->insertByName( m_sFollowPageStyleName, uno::makeAny(m_aFollowPageStyle) );
}
- else if(!m_aFollowPageStyle.is() )
+ else if(!m_aFollowPageStyle.is() && xPageStyles.is() )
{
xPageStyles->getByName(m_sFollowPageStyleName) >>= m_aFollowPageStyle;
}
@@ -1005,7 +1006,8 @@ void SectionPropertyMap::_ApplyProperties( uno::Reference< beans::XPropertySet >
{
try
{
- xStyle->setPropertyValue( rPropNameSupplier.GetName( aMapIter->first.eId ), aMapIter->second );
+ if (xStyle.is())
+ xStyle->setPropertyValue( rPropNameSupplier.GetName( aMapIter->first.eId ), aMapIter->second );
}
catch( const uno::Exception& )
{
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 2ad94a27f..53ef431bf 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -222,7 +222,8 @@ void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc
uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
// Record changes value
- xDocProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RecordChanges")), uno::makeAny( m_pImpl->m_bRecordChanges ) );
+ if (xDocProps.is())
+ xDocProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RecordChanges")), uno::makeAny( m_pImpl->m_bRecordChanges ) );
}
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index 3c326d98b..af4589692 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -69,10 +69,11 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
xExprtr->setSourceDocument(m_xSrcDoc);
return xFltr->filter(aDescriptor);
}
- else if ( m_xDstDoc.is() )
+
+ SvtMiscOptions aMiscOptions;
+ if (aMiscOptions.IsExperimentalMode() || !m_xDstDoc.is() )
{
- SvtMiscOptions aMiscOptions;
- if (aMiscOptions.IsExperimentalMode())
+ try
{
MediaDescriptor aMediaDesc( aDescriptor );
#ifdef DEBUG_IMPORT
@@ -80,7 +81,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr();
writerfilter::TagLogger::Pointer_t dmapperLogger
- (writerfilter::TagLogger::getInstance("DOMAINMAPPER"));
+ (writerfilter::TagLogger::getInstance("DOMAINMAPPER"));
dmapperLogger->setFileName(sURLc);
dmapperLogger->startDocument();
#endif
@@ -102,20 +103,23 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
#endif
return sal_True;
}
-
- // if not, then use the old importer
- uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfImport" ))), uno::UNO_QUERY_THROW);
- if (!xIfc.is())
- return sal_False;
- uno::Reference< document::XImporter > xImprtr(xIfc, uno::UNO_QUERY_THROW);
- uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW);
- if (!xImprtr.is() || !xFltr.is())
+ catch( const uno::Exception& rEx)
+ {
return sal_False;
- xImprtr->setTargetDocument(m_xDstDoc);
- return xFltr->filter(aDescriptor);
+ }
}
- return sal_False;
+
+ // if not, then use the old importer
+ uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
+ uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfImport" ))), uno::UNO_QUERY_THROW);
+ if (!xIfc.is())
+ return sal_False;
+ uno::Reference< document::XImporter > xImprtr(xIfc, uno::UNO_QUERY_THROW);
+ uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW);
+ if (!xImprtr.is() || !xFltr.is())
+ return sal_False;
+ xImprtr->setTargetDocument(m_xDstDoc);
+ return xFltr->filter(aDescriptor);
}
void RtfFilter::cancel( ) throw (uno::RuntimeException)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index cdefe9eaf..0dccaef0f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/io/UnexpectedEOFException.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <editeng/borderline.hxx>
#include <rtl/strbuf.hxx>
@@ -285,7 +286,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
OSL_ASSERT(m_xModelFactory.is());
uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(m_xDstDoc, uno::UNO_QUERY);
- m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY);
+ if (xDocumentPropertiesSupplier.is())
+ m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY);
m_pGraphicHelper = new oox::GraphicHelper(m_xContext, xFrame, m_xStorage);
@@ -474,12 +476,15 @@ void RTFDocumentImpl::resolve(Stream & rMapper)
break;
case ERROR_GROUP_OVER:
OSL_TRACE("%s: unmatched '{'", OSL_THIS_FUNC);
+ throw io::UnexpectedEOFException();
break;
case ERROR_EOF:
OSL_TRACE("%s: unexpected end of file", OSL_THIS_FUNC);
+ throw io::UnexpectedEOFException();
break;
case ERROR_HEX_INVALID:
OSL_TRACE("%s: invalid hex char", OSL_THIS_FUNC);
+ throw io::WrongFormatException();
break;
case ERROR_CHAR_OVER:
OSL_TRACE("%s: characters after last '}'", OSL_THIS_FUNC);
@@ -2174,12 +2179,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aFormfieldSprms->push_back(make_pair(NS_ooxml::LN_CT_FFDDList_result, pIntValue));
break;
case RTF_EDMINS:
- m_xDocumentProperties->setEditingDuration(nParam);
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setEditingDuration(nParam);
break;
case RTF_NOFPAGES:
case RTF_NOFWORDS:
case RTF_NOFCHARS:
case RTF_NOFCHARSWS:
+ if (m_xDocumentProperties.is())
{
uno::Sequence<beans::NamedValue> aSet = m_xDocumentProperties->getDocumentStatistics();
OUString aName;
@@ -2209,7 +2216,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
}
break;
case RTF_VERSION:
- m_xDocumentProperties->setEditingCycles(nParam);
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setEditingCycles(nParam);
break;
case RTF_VERN:
// Ignore this for now, later the RTF writer version could be used to add hacks for older buggy writers.
@@ -2629,24 +2637,27 @@ int RTFDocumentImpl::popState()
RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, m_aStates.top().nCurrentEncoding)));
m_aFormfieldSprms->push_back(make_pair(NS_ooxml::LN_CT_FFTextInput_default, pDValue));
}
- else if (m_aStates.top().nDestinationState == DESTINATION_CREATIONTIME)
+ else if (m_aStates.top().nDestinationState == DESTINATION_CREATIONTIME && m_xDocumentProperties.is())
m_xDocumentProperties->setCreationDate(lcl_getDateTime(m_aStates));
- else if (m_aStates.top().nDestinationState == DESTINATION_REVISIONTIME)
+ else if (m_aStates.top().nDestinationState == DESTINATION_REVISIONTIME && m_xDocumentProperties.is())
m_xDocumentProperties->setModificationDate(lcl_getDateTime(m_aStates));
- else if (m_aStates.top().nDestinationState == DESTINATION_PRINTTIME)
+ else if (m_aStates.top().nDestinationState == DESTINATION_PRINTTIME && m_xDocumentProperties.is())
m_xDocumentProperties->setPrintDate(lcl_getDateTime(m_aStates));
- else if (m_aStates.top().nDestinationState == DESTINATION_AUTHOR)
+ else if (m_aStates.top().nDestinationState == DESTINATION_AUTHOR && m_xDocumentProperties.is())
m_xDocumentProperties->setAuthor(m_aDestinationText.makeStringAndClear());
- else if (m_aStates.top().nDestinationState == DESTINATION_COMMENT)
+ else if (m_aStates.top().nDestinationState == DESTINATION_COMMENT && m_xDocumentProperties.is())
m_xDocumentProperties->setGenerator(m_aDestinationText.makeStringAndClear());
else if (m_aStates.top().nDestinationState == DESTINATION_OPERATOR
|| m_aStates.top().nDestinationState == DESTINATION_COMPANY)
{
OUString aName = m_aStates.top().nDestinationState == DESTINATION_OPERATOR ?
OUString(RTL_CONSTASCII_USTRINGPARAM("Operator")) : OUString(RTL_CONSTASCII_USTRINGPARAM("Company"));
- uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
- xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVEABLE,
- uno::makeAny(m_aDestinationText.makeStringAndClear()));
+ if (m_xDocumentProperties.is())
+ {
+ uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
+ xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVEABLE,
+ uno::makeAny(m_aDestinationText.makeStringAndClear()));
+ }
}
else if (m_aStates.top().nDestinationState == DESTINATION_OBJDATA)
{
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 888d3213d..f83280ded 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -63,9 +63,8 @@ RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument,
: m_rImport(rDocument)
{
uno::Reference<drawing::XDrawPageSupplier> xDrawings(xDstDoc, uno::UNO_QUERY);
- OSL_ASSERT(xDrawings.is());
- m_xDrawPage.set(xDrawings->getDrawPage(), uno::UNO_QUERY);
- OSL_ASSERT(m_xDrawPage.is());
+ if (m_xDrawPage.is() && xDrawings.is())
+ m_xDrawPage.set(xDrawings->getDrawPage(), uno::UNO_QUERY);
}
RTFSdrImport::~RTFSdrImport()
@@ -74,7 +73,8 @@ RTFSdrImport::~RTFSdrImport()
void RTFSdrImport::createShape(OUString aStr, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet)
{
- xShape.set(m_rImport.getModelFactory()->createInstance(aStr), uno::UNO_QUERY);
+ if (m_rImport.getModelFactory().is())
+ xShape.set(m_rImport.getModelFactory()->createInstance(aStr), uno::UNO_QUERY);
xPropertySet.set(xShape, uno::UNO_QUERY);
}
@@ -280,7 +280,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
return;
}
- m_xDrawPage->add(xShape);
+ if (m_xDrawPage.is())
+ m_xDrawPage->add(xShape);
if (bCustom)
{
uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(xShape, uno::UNO_QUERY);
@@ -315,8 +316,11 @@ void RTFSdrImport::resolve(RTFShape& rShape)
xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CustomShapeGeometry")), uno::Any(aGeomPropSeq));
// Set position and size
- xShape->setPosition(awt::Point(rShape.nLeft, rShape.nTop));
- xShape->setSize(awt::Size(rShape.nRight - rShape.nLeft, rShape.nBottom - rShape.nTop));
+ if (xShape.is())
+ {
+ xShape->setPosition(awt::Point(rShape.nLeft, rShape.nTop));
+ xShape->setSize(awt::Size(rShape.nRight - rShape.nLeft, rShape.nBottom - rShape.nTop));
+ }
// Send it to dmapper
m_rImport.Mapper().startShape(xShape);
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index 46d967df2..847dd2493 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -178,6 +178,10 @@ int RTFTokenizer::resolveKeyword()
aBuf.append(ch);
Strm() >> ch;
}
+ if (aBuf.getLength() > 32)
+ // See RTF spec v1.9.1, page 7
+ // A control word's name cannot be longer than 32 letters.
+ throw io::BufferSizeExceededException();
if (ch == '-')
{