[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source
sd/qa/unit/data/odp/tdf99224.odp |binary sd/qa/unit/export-tests.cxx | 12 sd/qa/unit/sdmodeltestbase.hxx | 16 sd/source/filter/eppt/pptx-epptooxml.cxx |4 +++- 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit e8e761ed003f5e509fea8eebd47111b1ed6aa672 Author: Miklos VajnaDate: Tue Apr 12 10:30:11 2016 +0200 tdf#99224 PPTX export: implement support for images with text In case an image had text, then ShapeExport::WriteGraphicObjectShapePart() wanted to write "only the text", but PowerPointShapeExport::WriteTextShape() had no idea how to write an image, so at the end nothing was exported. (cherry picked from commit fc70e4c4e192372f77511bc6ce2bc77b9c9539be) Conflicts: sd/qa/unit/export-tests.cxx Change-Id: I6c1ad0b41d4c5dc260b952322fb8a59e7f175603 Reviewed-on: https://gerrit.libreoffice.org/24017 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sd/qa/unit/data/odp/tdf99224.odp b/sd/qa/unit/data/odp/tdf99224.odp new file mode 100644 index 000..e52a000 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf99224.odp differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 4d1de95..2387447 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -112,6 +112,7 @@ public: void testBnc822341(); #endif void testTdf80224(); +void testTdf99224(); CPPUNIT_TEST_SUITE(SdExportTest); CPPUNIT_TEST(testFdo90607); @@ -148,6 +149,7 @@ public: CPPUNIT_TEST(testBnc822341); #endif CPPUNIT_TEST(testTdf80224); +CPPUNIT_TEST(testTdf99224); CPPUNIT_TEST_SUITE_END(); }; @@ -1238,6 +1240,16 @@ void SdExportTest::testTdf80224() xDocShRef->DoClose(); } +void SdExportTest::testTdf99224() +{ +sd::DrawDocShellRef xShell = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/tdf99224.odp"), ODP); +xShell = saveAndReload(xShell, PPTX); +uno::Reference xPage = getPage(0, xShell); +// This was 0: the image with text was lost on export. +CPPUNIT_ASSERT_EQUAL(static_cast(1), xPage->getCount()); +xShell->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index a5b136c..717a5db 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -250,6 +250,22 @@ protected: } xDocShRef->DoClose(); } + +uno::Reference< drawing::XDrawPagesSupplier > getDoc( sd::DrawDocShellRef xDocShRef ) +{ +uno::Reference< drawing::XDrawPagesSupplier > xDoc ( +xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); +CPPUNIT_ASSERT_MESSAGE( "no document", xDoc.is() ); +return xDoc; +} + +uno::Reference< drawing::XDrawPage > getPage( int nPage, sd::DrawDocShellRef xDocShRef ) +{ +uno::Reference< drawing::XDrawPagesSupplier > xDoc( getDoc( xDocShRef ) ); +uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex( nPage ), uno::UNO_QUERY_THROW ); +CPPUNIT_ASSERT_MESSAGE( "no page", xPage.is() ); +return xPage; +} }; #endif diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 0c045d3..20aeed8 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -232,7 +232,7 @@ ShapeExport& PowerPointShapeExport::WriteTextShape( Reference< XShape > xShape ) DBG(printf( "shape(text): %s\n", USS(sShapeType) )); -if ( sShapeType == "com.sun.star.drawing.TextShape" ) +if ( sShapeType == "com.sun.star.drawing.TextShape" || sShapeType == "com.sun.star.drawing.GraphicObjectShape" ) { ShapeExport::WriteTextShape( xShape ); } @@ -273,6 +273,8 @@ ShapeExport& PowerPointShapeExport::WriteTextShape( Reference< XShape > xShape ) if( !WritePlaceholder( xShape, Title, mbMaster ) ) ShapeExport::WriteTextShape( xShape ); } +else +SAL_WARN("sd.filter", "PowerPointShapeExport::WriteTextShape: shape of type '" << sShapeType << "' is ignored"); return *this; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source
sd/qa/unit/data/ppt/pass/hang-22.ppt |binary sd/source/filter/ppt/pptin.cxx |3 - sd/source/filter/ppt/propread.cxx| 78 +-- sd/source/filter/ppt/propread.hxx|4 - 4 files changed, 43 insertions(+), 42 deletions(-) New commits: commit 642779743f74edcaa4e69a722ea07918ee79c592 Author: Caolán McNamaraDate: Fri Sep 18 12:46:29 2015 +0100 check stream status and string lengths (cherry picked from commit 7af19f45b35c428d3e06972806e5a05489f45955) if nSize was 1 with unicode encoding nSize would wrap around in lcl_getMaxSafeStrLen (cherry picked from commit f6368c29bdc3a9017bcae3f064d2cd8c7e37ed10) rework this so we don't read the string, backup and re-read the string again (cherry picked from commit 8523e57e427ef5b0b7f7067dcdd07f01176d2160) Change-Id: I99f3d4a2ec760228f485d01fce856deb9c068431 Reviewed-on: https://gerrit.libreoffice.org/18690 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sd/qa/unit/data/ppt/pass/hang-22.ppt b/sd/qa/unit/data/ppt/pass/hang-22.ppt new file mode 100644 index 000..c869b39 Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-22.ppt differ diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index dc4cadd..8cdaaff 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -367,7 +367,8 @@ bool ImplSdPPTImport::Import() if ( pSection ) { Dictionary aDict; -if ( pSection->GetDictionary( aDict ) ) +pSection->GetDictionary(aDict); +if (!aDict.empty()) { Dictionary::const_iterator iter = aDict.find( OUString("_PID_HLINKS") ); diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index e4dc401..2f5fc73 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -269,10 +269,8 @@ void Section::AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBu maEntries.push_back( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ) ); } -bool Section::GetDictionary( Dictionary& rDict ) +void Section::GetDictionary(Dictionary& rDict) { -bool bRetValue = false; - boost::ptr_vector::iterator iter; for (iter = maEntries.begin(); iter != maEntries.end(); ++iter) { @@ -280,48 +278,50 @@ bool Section::GetDictionary( Dictionary& rDict ) break; } -if ( iter != maEntries.end() ) +if (iter == maEntries.end()) +return; + +SvMemoryStream aStream( iter->mpBuf, iter->mnSize, StreamMode::READ ); +aStream.Seek( STREAM_SEEK_TO_BEGIN ); +sal_uInt32 nDictCount(0); +aStream.ReadUInt32( nDictCount ); +for (sal_uInt32 i = 0; i < nDictCount; ++i) { -sal_uInt32 nDictCount, nId, nSize, nPos; -SvMemoryStream aStream( iter->mpBuf, iter->mnSize, StreamMode::READ ); -aStream.Seek( STREAM_SEEK_TO_BEGIN ); -aStream.ReadUInt32( nDictCount ); -for ( sal_uInt32 i = 0; i < nDictCount; i++ ) +sal_uInt32 nId(0), nSize(0); +aStream.ReadUInt32(nId).ReadUInt32(nSize); +if (!aStream.good() || nSize > aStream.remainingSize()) +break; +if (mnTextEnc == RTL_TEXTENCODING_UCS2) +nSize >>= 1; +if (!nSize) +continue; +OUString aString; +try { -aStream.ReadUInt32( nId ).ReadUInt32( nSize ); -if ( nSize ) +if ( mnTextEnc == RTL_TEXTENCODING_UCS2 ) { -OUString aString; -nPos = aStream.Tell(); -try -{ -sal_Char* pString = new sal_Char[ nSize ]; -aStream.Read( pString, nSize ); -if ( mnTextEnc == RTL_TEXTENCODING_UCS2 ) -{ -nSize >>= 1; -aStream.Seek( nPos ); -sal_Unicode* pWString = reinterpret_cast (pString); -for (sal_uInt32 j = 0; j < nSize; ++j) -aStream.ReadUInt16(pWString[j]); -aString = OUString(pWString, lcl_getMaxSafeStrLen(nSize)); -} -else -aString = OUString(pString, lcl_getMaxSafeStrLen(nSize), mnTextEnc); -delete[] pString; -} -catch( const std::bad_alloc& ) -{ -OSL_FAIL( "sd Section::GetDictionary bad alloc" ); -} -if ( aString.isEmpty() ) -break; -rDict.insert( std::make_pair(aString,nId) ); +sal_Unicode* pWString = new sal_Unicode[nSize]; +
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source
sd/qa/unit/data/ppt/pass/hang-21.ppt |binary sd/source/filter/ppt/propread.cxx|8 2 files changed, 8 insertions(+) New commits: commit 2ab9d3eac916468c303f8bf9b919805418f813c1 Author: Caolán McNamaraDate: Sat Aug 29 20:26:27 2015 +0100 check stream status Change-Id: I6b9537cf94ac1c5d996ba64ddf878745dadde254 (cherry picked from commit 452cd9e75de657e996e17510fe5d3539065489d1) Reviewed-on: https://gerrit.libreoffice.org/18128 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sd/qa/unit/data/ppt/pass/hang-21.ppt b/sd/qa/unit/data/ppt/pass/hang-21.ppt new file mode 100644 index 000..99cf49f Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-21.ppt differ diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index be288c8..ca9cbe0 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -497,10 +497,18 @@ void Section::Read( SotStorageStream *pStrm ) { sal_uInt32 nDictCount(0); pStrm->ReadUInt32(nDictCount); +auto nMaxRecordsPossible = pStrm->remainingSize() / (sizeof(sal_uInt32)*2); +if (nDictCount > nMaxRecordsPossible) +{ +SAL_WARN("sd.filter", "Dictionary count of " << nDictCount << " claimed, only " << nMaxRecordsPossible << " possible"); +nDictCount = nMaxRecordsPossible; +} for (sal_uInt32 i = 0; i < nDictCount; ++i) { sal_uInt32 nSize(0); pStrm->ReadUInt32( nSize ).ReadUInt32( nSize ); +if (!pStrm->good()) +break; sal_uInt64 nPos = pStrm->Tell() + nSize; if (nPos != pStrm->Seek(nPos)) break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source
sd/qa/unit/data/ppt/pass/crash-2.ppt |binary sd/source/filter/ppt/propread.cxx| 11 +-- 2 files changed, 9 insertions(+), 2 deletions(-) New commits: commit e444e2a1204932388c0a9bdcc31296e2bd549e4b Author: Caolán McNamara caol...@redhat.com Date: Fri Aug 28 14:33:05 2015 +0100 guard against 0 item size Change-Id: I9c4c2f0fe2d892615b3c70e08da0cab6da13338a (cherry picked from commit 2aadad1e89e96cb80c15fe1069cb6365f0cade1d) Reviewed-on: https://gerrit.libreoffice.org/18113 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: David Tardon dtar...@redhat.com diff --git a/sd/qa/unit/data/ppt/pass/crash-2.ppt b/sd/qa/unit/data/ppt/pass/crash-2.ppt new file mode 100644 index 000..78a4da4 Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/crash-2.ppt differ diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index 4f2e37b..be288c8 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -93,7 +93,7 @@ bool PropItem::Read( OUString rString, sal_uInt32 nStringType, bool bAlign ) { case VT_LPSTR : { -if ( nItemSize ) +if (nItemSize) { auto nMaxSizePossible = remainingSize(); if (nItemSize nMaxSizePossible) @@ -101,6 +101,10 @@ bool PropItem::Read( OUString rString, sal_uInt32 nStringType, bool bAlign ) SAL_WARN(sd.filter, String of Len nItemSize claimed, only nMaxSizePossible possible); nItemSize = nMaxSizePossible; } +} + +if (nItemSize) +{ try { sal_Char* pString = new sal_Char[ nItemSize ]; @@ -144,7 +148,7 @@ bool PropItem::Read( OUString rString, sal_uInt32 nStringType, bool bAlign ) case VT_LPWSTR : { -if ( nItemSize ) +if (nItemSize) { auto nMaxSizePossible = remainingSize() / sizeof(sal_Unicode); if (nItemSize nMaxSizePossible) @@ -152,7 +156,10 @@ bool PropItem::Read( OUString rString, sal_uInt32 nStringType, bool bAlign ) SAL_WARN(sd.filter, String of Len nItemSize claimed, only nMaxSizePossible possible); nItemSize = nMaxSizePossible; } +} +if (nItemSize) +{ try { sal_Unicode* pString = new sal_Unicode[ nItemSize ]; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source
sd/qa/unit/data/ppt/pass/hang-20.ppt |binary sd/source/filter/ppt/pptin.cxx | 34 +- 2 files changed, 25 insertions(+), 9 deletions(-) New commits: commit 062bb3675bf05e5a8150bddb7b4c0e404961fa13 Author: Caolán McNamara caol...@redhat.com Date: Fri Aug 28 16:14:07 2015 +0100 check stream status Change-Id: I609c8c4f4e843601361b61f55e0325ad99db3c23 (cherry picked from commit dc1be62d75e654e17c2f4c02804b7fd48d5a2515) Reviewed-on: https://gerrit.libreoffice.org/18115 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: David Tardon dtar...@redhat.com diff --git a/sd/qa/unit/data/ppt/pass/hang-20.ppt b/sd/qa/unit/data/ppt/pass/hang-20.ppt new file mode 100644 index 000..7bfe75d Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-20.ppt differ diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 3cb8d80..dc4cadd 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -279,7 +279,6 @@ bool ImplSdPPTImport::Import() if ( nSlideCount pSection-GetProperty( PID_HEADINGPAIR, aPropItem ) ) { sal_uInt32 nSlideTitleIndex = 0, nSlideTitleCount = 0; -sal_uInt32 i, nTemp; OUString aUString; @@ -290,13 +289,14 @@ bool ImplSdPPTImport::Import() { nVecCount = 1; sal_uInt32 nEntryCount = 0; -for ( i = 0; i nVecCount; i++ ) +for (sal_uInt32 i = 0; i nVecCount; ++i) { if ( !aPropItem.Read( aUString, VT_EMPTY, false ) ) break; aPropItem.ReadUInt32( nType ); if ( ( nType != VT_I4 ) ( nType != VT_UI4 ) ) break; +sal_uInt32 nTemp(0); aPropItem.ReadUInt32( nTemp ); if ( aUString == Slide Titles || aUString == Folientitel ) { @@ -311,17 +311,33 @@ bool ImplSdPPTImport::Import() aPropItem.ReadUInt32( nType ) .ReadUInt32( nVecCount ); -if ( ( nVecCount = ( nSlideTitleIndex + nSlideTitleCount ) ) - ( nType == ( VT_LPSTR | VT_VECTOR ) ) ) +bool bVecOk = ( ( nVecCount = (nSlideTitleIndex + nSlideTitleCount) ) + ( nType == ( VT_LPSTR | VT_VECTOR ) ) ); + +if (bVecOk) { -for ( i = 0; i != nSlideTitleIndex; i++ ) +for (sal_uInt32 i = 0; i != nSlideTitleIndex; ++i) { -aPropItem.ReadUInt32( nTemp ); -aPropItem.SeekRel( nTemp ); +sal_uInt32 nTemp(0); +aPropItem.ReadUInt32(nTemp); +if (!aPropItem.good()) +{ +bVecOk = false; +break; +} +auto nPos = aPropItem.Tell() + nTemp; +if (nPos != aPropItem.Seek(nPos)) +{ +bVecOk = false; +break; +} } -for ( i = 0; i nSlideTitleCount; i++ ) +} +if (bVecOk) +{ +for (sal_uInt32 i = 0; i nSlideTitleCount; ++i) { -if ( !aPropItem.Read( aUString, nType, false ) ) +if (!aPropItem.Read(aUString, nType, false)) break; OUString aString( aUString ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source
sd/qa/unit/data/ppt/pass/hang-10.ppt |binary sd/source/filter/ppt/pptin.cxx |6 -- 2 files changed, 4 insertions(+), 2 deletions(-) New commits: commit 15c185132f8c425722c6cdb380857e70a0ce04fd Author: Caolán McNamara caol...@redhat.com Date: Thu Aug 27 14:28:35 2015 +0100 check status of SeekTo (cherry picked from commit 932f6de91904f86f38d2914b9ce07b94dfadac0c) Change-Id: Ia2bb397c3fdd783cab77a6b0dbc31c9e3d19326b Reviewed-on: https://gerrit.libreoffice.org/18094 Reviewed-by: Michael Meeks michael.me...@collabora.com Tested-by: Michael Meeks michael.me...@collabora.com diff --git a/sd/qa/unit/data/ppt/pass/hang-10.ppt b/sd/qa/unit/data/ppt/pass/hang-10.ppt new file mode 100644 index 000..99a81c4 Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-10.ppt differ diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 7565fd4..0b2c0c8 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -780,7 +780,8 @@ bool ImplSdPPTImport::Import() if ( nObjCount++ ) // skipping the first object { Rectangle aEmpty; - aHd2.SeekToBegOfRecord( rStCtrl ); +if (!aHd2.SeekToBegOfRecord( rStCtrl )) +break; SdrObject* pImpObj = ImportObj( rStCtrl, (void*)aProcessData, aEmpty, aEmpty ); if ( pImpObj ) { @@ -789,7 +790,8 @@ bool ImplSdPPTImport::Import() } } } -aHd2.SeekToEndOfRecord( rStCtrl ); +if (!aHd2.SeekToEndOfRecord(rStCtrl)) +break; } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source
sd/qa/unit/data/ppt/pass/hang-5.ppt |binary sd/source/filter/ppt/pptin.cxx |2 +- 2 files changed, 1 insertion(+), 1 deletion(-) New commits: commit d269afa92d524eaf0e0236aadde9cea90ccaa18c Author: Caolán McNamara caol...@redhat.com Date: Thu Aug 27 13:35:37 2015 +0100 avoid hang in certain ppts Change-Id: Iedba71b72fc815b274ca5e0da0903a558947cb06 (cherry picked from commit 90dc4e38928fffc3ed5fcbed40109712eb97e203) Reviewed-on: https://gerrit.libreoffice.org/18089 Reviewed-by: Michael Meeks michael.me...@collabora.com Tested-by: Michael Meeks michael.me...@collabora.com diff --git a/sd/qa/unit/data/ppt/pass/hang-5.ppt b/sd/qa/unit/data/ppt/pass/hang-5.ppt new file mode 100644 index 000..cfaa8f4 Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-5.ppt differ diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index ddf80f1..8651c68 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2544,7 +2544,7 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream rSt, DffObjData rObjData, voi DffRecordHeader rHdClientData = *maShapeRecords.Current(); while( true ) { -sal_uInt32 nClientDataLen = rHdClientData.GetRecEndFilePos(); +sal_uInt32 nClientDataLen = SanitizeEndPos(rSt, rHdClientData.GetRecEndFilePos()); DffRecordHeader aHd; do { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits