sw/qa/extras/rtfimport/data/tdf108123.rtf | 48 ++++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 10 ++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 ++-- 3 files changed, 64 insertions(+), 3 deletions(-)
New commits: commit f5375d5539897bff0aef82df92b7d485b8839004 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jun 7 09:44:40 2017 +0200 tdf#108123 RTF paste: fix asymmetric shape <-> table manager stack Make sure that even if the text append stack is empty (and we return early) the table manager push/pop operations are in sync with the shape start/end, otherwise we'll have an empty table manager stack. That is a problem as writerfilter::dmapper::DomainMapper_Impl::getTableManager() assumes that it always has at least one element. Change-Id: I92b3381e820bc8eaeb351532a6ce8909490c0f30 Reviewed-on: https://gerrit.libreoffice.org/38490 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sw/qa/extras/rtfimport/data/tdf108123.rtf b/sw/qa/extras/rtfimport/data/tdf108123.rtf new file mode 100644 index 000000000000..d4e51c347e84 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf108123.rtf @@ -0,0 +1,48 @@ +{\rtf1\ansi\deff4\adeflang1025 +\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720 +\formprot\formshade +\paperh15840\paperw12240\margl2880\margr2160\margt720\margb720\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\titlepg\titlepg +{\headerf\pard\plain } +{\footerf\pard\plain } +{\dbch\af30\rtlch \ltrch\loch\loch\f5\hich\af5 +DL and HIPAA} +\par \sect\sectd\sectunlocked1\pgwsxn12240\pghsxn15840\marglsxn1440\margrsxn1440\margtsxn1350\headery720\margbsxn1584\footery720\pgnstarts1\pgnrestart\pgndec\sbkpage\headery720 +\footery720 +\pard\plain \s163\sl-280\slmult0\qj\keep\widctlpar\sb480\sa0\keepn\ltrpar\scaps0\caps0\cf23\b\kerning0\dbch\af19\dbch\af19\afs28\ab\loch\f11\fs28 +{\cf20\dbch\af30\rtlch \ltrch\loch\loch\f5\hich\af5 +Table of Contents} +\par \pard\plain \s3\sl-280\slmult0\ql\widctlpar\sb240\sa20\keepn\ltrpar\cf20\i\b\loch\f6\hich\af6\qj +{ +\dbch\af30\rtlch \ltrch\loch\loch\f5\hich\af5 +1.1 Complete Core Security Training} +\par +{\shp +{\*\shpinst\shpwr2\shpwrk3\shpbypara\shpbyignore\shptop178\shpbottom1934\shpbxcolumn\shpbxignore\shpleft5543\shpright9344 +{\sp +{\sn dxWrapDistLeft} +{\sv 114300} +} +{\sp +{\sn dxWrapDistRight} +{\sv 114300} +} +{\shptxt\s170\ql\widctlpar\ltrpar\hyphpar0\afs22\cf0\dbch\af26\langfe1033\dbch\af26\alang1025\loch\f7\hich\af7\fs22\lang1033 +{\i\b\dbch\af30\afs16\rtlch \ltrch\loch\fs16\loch\f5\hich\af5 +Aligns with HIPAA Security Rule:} +\par \s170\ql\widctlpar\ltrpar\hyphpar0\afs22\cf0\dbch\af26\langfe1033\dbch\af26\alang1025\loch\f7\hich\af7\fs22\lang1033\rtlch \ltrch\loch +\pard} +} +} +\pard\plain \s3\sl-280\slmult0\ql\widctlpar\sb240\sa20\keepn\ltrpar\cf20\i\b\loch\f6\hich\af6\qj +{ +{\*\bkmkstart _Toc261331228} +{\*\bkmkstart _Toc276629053} +\dbch\af30\rtlch \ltrch\loch\loch\f5\hich\af5 +2.2 Create Quality Gates and Bug Bars} +{ +{\*\bkmkend _Toc261331228} +{\*\bkmkend _Toc276629053} +\dbch\af30\rtlch \ltrch\loch\loch\f5\hich\af5 + } +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 90fe265d8238..03dbbcfb024f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -885,6 +885,16 @@ DECLARE_RTFIMPORT_TEST(testFdo61193, "hello.rtf") paste("fdo61193.rtf", xEnd); } +DECLARE_RTFIMPORT_TEST(testTdf108123, "hello.rtf") +{ + // This crashed, the shape push/pop and table manager stack went out of + // sync -> we tried to de-reference an empty stack. + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xEnd = xText->getEnd(); + paste("tdf108123.rtf", xEnd); +} + DECLARE_RTFIMPORT_TEST(testShptxtPard, "shptxt-pard.rtf") { // The problem was that \pard inside \shptxt caused loss of shape text diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 4bb4013ade9e..fe04cebf55fc 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1917,13 +1917,16 @@ uno::Reference<drawing::XShape> DomainMapper_Impl::PopPendingShape() void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape > & xShape ) { + // Append these early, so the context and the table manager stack will be + // in sync, even if the text append stack is empty. + appendTableManager(); + appendTableHandler(); + getTableManager().startLevel(); + if (m_aTextAppendStack.empty()) return; uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend; - appendTableManager( ); - appendTableHandler( ); - getTableManager().startLevel(); try { uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits