configure.ac | 2 cui/source/dialogs/iconcdlg.cxx | 4 cui/uiconfig/ui/spelloptionsdialog.ui | 1 lotuswordpro/source/filter/bencont.cxx | 2 lotuswordpro/source/filter/lwp9reader.cxx | 2 lotuswordpro/source/filter/lwpcelllayout.cxx | 15 + lotuswordpro/source/filter/lwpdoc.cxx | 24 +- lotuswordpro/source/filter/lwpfnlayout.cxx | 4 lotuswordpro/source/filter/lwpfont.cxx | 5 lotuswordpro/source/filter/lwpfootnote.cxx | 2 lotuswordpro/source/filter/lwpfoundry.cxx | 8 lotuswordpro/source/filter/lwpframelayout.cxx | 10 - lotuswordpro/source/filter/lwpfribframe.cxx | 2 lotuswordpro/source/filter/lwpfribptr.cxx | 6 lotuswordpro/source/filter/lwpfribsection.cxx | 6 lotuswordpro/source/filter/lwpfribtable.cxx | 6 lotuswordpro/source/filter/lwpidxmgr.cxx | 7 lotuswordpro/source/filter/lwplayout.cxx | 202 +++++++++++-------------- lotuswordpro/source/filter/lwplayout.hxx | 5 lotuswordpro/source/filter/lwpnotes.cxx | 6 lotuswordpro/source/filter/lwpobj.cxx | 3 lotuswordpro/source/filter/lwpobj.hxx | 29 +++ lotuswordpro/source/filter/lwpobjid.cxx | 6 lotuswordpro/source/filter/lwpobjstrm.cxx | 2 lotuswordpro/source/filter/lwppagelayout.cxx | 11 - lotuswordpro/source/filter/lwppara.cxx | 55 +++--- lotuswordpro/source/filter/lwppara.hxx | 2 lotuswordpro/source/filter/lwppara1.cxx | 2 lotuswordpro/source/filter/lwprowlayout.cxx | 7 lotuswordpro/source/filter/lwpsilverbullet.cxx | 5 lotuswordpro/source/filter/lwptablelayout.cxx | 2 lotuswordpro/source/filter/lwptabrack.cxx | 2 lotuswordpro/source/filter/lwptoc.cxx | 6 lotuswordpro/source/filter/lwpvpointer.cxx | 2 sfx2/source/dialog/backingwindow.cxx | 3 sfx2/source/dialog/backingwindow.hxx | 3 36 files changed, 253 insertions(+), 206 deletions(-)
New commits: commit 804c19f48d88ad4efc11dc4046b75bb6d6db8ff6 Author: Andras Timar <andras.ti...@collabora.com> Date: Thu Dec 10 16:17:43 2015 +0100 Bump version to 5.0-13 Change-Id: I2dafee880299d1f822f1cf3856f3e48e3987b6b0 diff --git a/configure.ac b/configure.ac index 37753d3..db9ab05 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([Collabora Office],[5.0.10.12],[],[],[https://CollaboraOffice.com/]) +AC_INIT([Collabora Office],[5.0.10.13],[],[],[https://CollaboraOffice.com/]) AC_PREREQ([2.59]) commit a2920ac6cd255cf27e51de58113c915ff53733fc Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 17:15:10 2015 +0000 Resolves: tdf#86845 hyperlink details not retained between tabs Change-Id: Ib6c1df4a97598c156b10b1730debb078e362e0d2 (cherry picked from commit eb38493c4101d8777052267ee83a5d4f883dd9ac) (cherry picked from commit e34e0c8d97b90786e9ca9cf88d9fc3e127ce8350) Reviewed-on: https://gerrit.libreoffice.org/20549 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit b82567327fa64ceb7d486774df3ac9c95763009c) diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index 0b77226..d6eab9a 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -333,8 +333,6 @@ void IconChoiceDialog::ShowPage(sal_uInt16 nId) { sal_uInt16 nOldPageId = GetCurPageId(); bool bInvalidate = nOldPageId != nId; - SetCurPageId(nId); - ActivatePageImpl(); if (bInvalidate) { IconChoicePageData* pOldData = GetPageData(nOldPageId); @@ -346,6 +344,8 @@ void IconChoiceDialog::ShowPage(sal_uInt16 nId) Invalidate(); } + SetCurPageId(nId); + ActivatePageImpl(); IconChoicePageData* pNewData = GetPageData(nId); if (pNewData && pNewData->pPage) ShowPageImpl(pNewData); commit fbff9f884dbf5aa1dc962d5b608c6ae1941a50ff Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Dec 10 13:38:52 2015 +0100 Memory leak (cherry picked from commit 5ac6e00274e732435b55c2908db9cea658fe549b) Conflicts: sfx2/source/dialog/backingwindow.cxx Change-Id: Ica40750d628946678019376d91db67ba3f9ed67e Reviewed-on: https://gerrit.libreoffice.org/20601 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 75f25d00848068c677fca450d35aa59af0422c60) diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 5686c43..2c0d8c0 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -96,7 +96,6 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) : mbIsSaveMode( false ), mbInitControls( false ), mnHideExternalLinks( 0 ), - mpAccExec( NULL ), maSelTemplates(cmpSelectionItems), maSelFolders(cmpSelectionItems) @@ -443,7 +442,7 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt ) // try the 'normal' accelerators (so that eg. Ctrl+Q works) if (!mpAccExec) { - mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper(); + mpAccExec.reset(svt::AcceleratorExecute::createAcceleratorHelper()); mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame); } diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index 8dfa84f..313361d 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -44,6 +44,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDesktop2.hpp> +#include <memory> #include <set> class ToolBox; @@ -92,7 +93,7 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer bool mbIsSaveMode; bool mbInitControls; sal_Int32 mnHideExternalLinks; - svt::AcceleratorExecute* mpAccExec; + std::unique_ptr<svt::AcceleratorExecute> mpAccExec; void setupButton(PushButton* pButton); void setupButton(MenuButton* pButton); commit 70ba21c385c9afb65c2183a26c5b7af2a8dfd477 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 09:49:07 2015 +0000 guard against missing table layout (cherry picked from commit 0c876483d278e3e5ba43e9eaf40ca713b6099703) Reviewed-on: https://gerrit.libreoffice.org/20576 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 4bc26e006dd4bde95eef706de43228679a41c4f7) Change-Id: I4bc7a7283f63124ccb50957ea64791644e01e267 Reviewed-on: https://gerrit.libreoffice.org/20577 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit e81d193d56f219610da5b8b10717741d8c5dc63c) diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index a587ec9..13d7307 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -696,8 +696,10 @@ LwpConnectedCellLayout::~LwpConnectedCellLayout() */ void LwpConnectedCellLayout::SetCellMap() { - // this function is called from LwpTableLayout, so it can't be NULL LwpTableLayout * pTableLayout = GetTableLayout(); + if (!pTableLayout) + return; + sal_uInt16 nRowSpan = m_nRealrowspan; for (sal_uInt16 iLoop = 0; iLoop < nRowSpan; iLoop ++) diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index e7bae0f..1f8265e 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -366,11 +366,14 @@ sal_uInt16 LwpRowLayout::GetCurMaxSpannedRows(sal_uInt8 nStartCol,sal_uInt8 nEnd */ void LwpRowLayout::ConvertCommonRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uInt8 nEndCol) { + LwpTableLayout* pTableLayout = GetParentTableLayout(); + if (!pTableLayout) + return; + XFRow* pRow = new XFRow; pRow->SetStyleName(m_StyleName); - XFCell * pCell = NULL; - LwpTableLayout* pTableLayout = GetParentTableLayout(); + XFCell * pCell = nullptr; LwpTable* pTable = pTableLayout->GetTable(); sal_uInt8 nCellStartCol,nCellEndCol; commit 44582512701e97f5f23ad86e904c9faa4c2953ce Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 10:00:58 2015 +0000 guard against infinite recursion on parsing objects Change-Id: Ia6502afde54dbf379bc9951c80c6594f1f436ef5 (cherry picked from commit fbd329800340a496def839181858964b1e3709a5) Reviewed-on: https://gerrit.libreoffice.org/20579 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 564687e728c98fec5ba6ffa39007793b2b4aa4e8) diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index c93b668..a0dc530 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -166,7 +166,7 @@ void LwpDocument::Parse(IXFStream* pOutputStream) rtl::Reference<LwpObject> pDocSock = GetSocket().obj( VO_DOCSOCK ); if(pDocSock.is()) { - pDocSock->Parse(pOutputStream); + pDocSock->DoParse(pOutputStream); } } @@ -412,7 +412,7 @@ void LwpDocument::ParseDocContent(IXFStream* pOutputStream) return; } pLayoutObj->SetFoundry(m_pFoundry); - pLayoutObj->Parse(pOutputStream); + pLayoutObj->DoParse(pOutputStream); } /** @@ -795,11 +795,11 @@ void LwpDocSock::Parse(IXFStream* pOutputStream) { rtl::Reference<LwpObject> pDoc = GetChildHead().obj(); if(pDoc.is()) - pDoc->Parse(pOutputStream); + pDoc->DoParse(pOutputStream); pDoc = GetNext().obj(); if(pDoc.is()) - pDoc->Parse(pOutputStream); + pDoc->DoParse(pOutputStream); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index 47a5614..feff262 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -1155,7 +1155,7 @@ void LwpDropcapLayout::Parse(IXFStream* pOutputStream) if(pPara.is()) { pPara->SetFoundry(m_pFoundry); - pPara->Parse(pOutputStream); + pPara->DoParse(pOutputStream); } } diff --git a/lotuswordpro/source/filter/lwpobj.cxx b/lotuswordpro/source/filter/lwpobj.cxx index 010b60e..be9a07f 100644 --- a/lotuswordpro/source/filter/lwpobj.cxx +++ b/lotuswordpro/source/filter/lwpobj.cxx @@ -64,7 +64,8 @@ * @descr construct lwpobject from stream */ LwpObject::LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm) - : m_ObjHdr(objHdr), m_pObjStrm(nullptr), m_pFoundry(nullptr), m_pStrm(pStrm), m_bRegisteringStyle(false) + : m_ObjHdr(objHdr), m_pObjStrm(nullptr), m_pFoundry(nullptr) + , m_pStrm(pStrm), m_bRegisteringStyle(false), m_bParsingStyle(false) { m_pObjStrm = new LwpObjectStream(pStrm, m_ObjHdr.IsCompressed(), static_cast<sal_uInt16>(m_ObjHdr.GetSize()) ); diff --git a/lotuswordpro/source/filter/lwpobj.hxx b/lotuswordpro/source/filter/lwpobj.hxx index 23ed6b2..978bc49 100644 --- a/lotuswordpro/source/filter/lwpobj.hxx +++ b/lotuswordpro/source/filter/lwpobj.hxx @@ -95,9 +95,11 @@ protected: LwpFoundry* m_pFoundry; LwpSvStream* m_pStrm; bool m_bRegisteringStyle; + bool m_bParsingStyle; protected: virtual void Read(); virtual void RegisterStyle(); + virtual void Parse(IXFStream* pOutputStream); public: void QuickRead(); //calls RegisterStyle but bails if DoRegisterStyle is called @@ -110,7 +112,17 @@ public: RegisterStyle(); m_bRegisteringStyle = false; } - virtual void Parse(IXFStream* pOutputStream); + //calls Parse but bails if DoParse is called + //on the same object recursively + void DoParse(IXFStream* pOutputStream) + { + if (m_bParsingStyle) + throw std::runtime_error("recursion in parsing"); + m_bParsingStyle = true; + Parse(pOutputStream); + m_bParsingStyle = false; + } + virtual void XFConvert(XFContentContainer* pCont); LwpFoundry* GetFoundry(){return m_pFoundry;} diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 5604863..0f78899 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -127,7 +127,7 @@ void LwpPageLayout::Parse(IXFStream* pOutputStream) if(pStory.is()) { pStory->SetFoundry(m_pFoundry); - pStory->Parse(pOutputStream); //Do not parse the next story + pStory->DoParse(pOutputStream); //Do not parse the next story } } commit 3022266d13f6169612d359e383b8f026a997e171 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 10:13:51 2015 +0000 guard against infinite recursion Change-Id: I43e195df570990f21c780311a98be64b682e5315 (cherry picked from commit 338c6ba3a0983009cfd1faff52ac56d6ea092d6f) Reviewed-on: https://gerrit.libreoffice.org/20582 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 1aba52d136d6a2abe7fbb7d6e17c6f1e7c6eed6a) diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index 0a3597e..c93b668 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -540,7 +540,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() LwpDocument* pDivision = GetLastDivision(); - while(pDivision) + while (pDivision && pDivision != this) { LwpDocument* pContentDivision = pDivision->GetLastDivisionWithContents(); if(pContentDivision) commit e97016f46cb4d5119097985c53dc4da62056de39 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 09:35:46 2015 +0000 guard against missing spacing property (cherry picked from commit 10de96bf0fb820b38607b0c25a0d3219ad343819) Reviewed-on: https://gerrit.libreoffice.org/20569 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit cb6f34b370da1d45e1c2b945b60cbcaf7b9c3a45) Change-Id: If5c50cddfee88cc92852737c1459ebe94b7256bb Reviewed-on: https://gerrit.libreoffice.org/20570 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 50ca71d16e37cb7612dd26172f5c876882cb700d) diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index ed03231..7ed4d1a 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -418,18 +418,20 @@ void LwpPara::RegisterStyle() case PP_LOCAL_SPACING: { noSpacing = false; - if (!rParaStyle.GetSpacing()) - OverrideSpacing(NULL,static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(),pOverStyle); - else + LwpSpacingOverride *pSpacing = static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(); + if (pSpacing) { - boost::scoped_ptr<LwpSpacingOverride> const - pSpacing(rParaStyle.GetSpacing()->clone()); - OverrideSpacing(pSpacing.get(), - static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(), - pOverStyle); + if (!rParaStyle.GetSpacing()) + OverrideSpacing(nullptr, pSpacing, pOverStyle); + else + { + std::unique_ptr<LwpSpacingOverride> const + pNewSpacing(rParaStyle.GetSpacing()->clone()); + OverrideSpacing(pNewSpacing.get(), pSpacing, pOverStyle); + } } - } break; + } case PP_LOCAL_BORDER: { OverrideParaBorder(pProps, pOverStyle); commit 5944b2ea8a66d9c613920d65bed85e66264752d2 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 11:48:47 2015 +0000 guard against missing geometry Change-Id: I6b2945f1d5a1654f6b5d6a5f5287b4cb9514d97c (cherry picked from commit d4d247866eac108162f43dae2c6ddbd9c12382a6) (cherry picked from commit 6a9f91915afbcff71121b3485376ab6f1fdcecee) Reviewed-on: https://gerrit.libreoffice.org/20596 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 8f2cfef6bc3d876cae6718f31cc45fde499c0a52) diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 8d0cce5..871e886 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1044,10 +1044,10 @@ sal_Int32 LwpMiddleLayout::DetermineWidth() { assert(false); } - else + else if (LwpLayoutGeometry* pGeo = GetGeometry()) { m_nAttributes3 |= STYLE3_WIDTHVALID; - return GetGeometry()->GetWidth(); + return pGeo->GetWidth(); } return 0; } commit 51d1071053319194781f627d91acfa4c2e8c44c4 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 11:42:46 2015 +0000 use of uninitialized variable Change-Id: I1149eb9f5946228a2448c121e7ec7211861b3b3d (cherry picked from commit 65deab68f7918c82026951b04a414eefee2683b2) (cherry picked from commit 84facdc8305f1d00f661e58aa0c474c7233d47dc) Reviewed-on: https://gerrit.libreoffice.org/20593 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 7638b0a939a09b23d095bb956051b539d1d9c9d7) diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx index a096951..3cb4a09 100644 --- a/lotuswordpro/source/filter/bencont.cxx +++ b/lotuswordpro/source/filter/bencont.cxx @@ -231,7 +231,7 @@ BenError LtcBenContainer::SeekFromEnd(long Offset) */ LtcUtBenValueStream * LtcBenContainer::FindNextValueStreamWithPropertyName(const char * sPropertyName, LtcUtBenValueStream * pCurrentValueStream) { - CBenPropertyName * pPropertyName; + CBenPropertyName * pPropertyName(nullptr); RegisterPropertyName(sPropertyName, &pPropertyName); // Get property name object if (NULL == pPropertyName) commit 867f7144ffc88ab15ad84708484665483c6dd3f4 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 10:06:58 2015 +0000 guard against missing table container Change-Id: I11f6381374c7fc12374cd5089e581ddc777005e2 (cherry picked from commit c732a1ae8cc0cc94bfeddba243657a0b9e52a0f9) Reviewed-on: https://gerrit.libreoffice.org/20580 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit b54e5c8154edaae9b553cfa7d3c0141c1d4ccce1) diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index e2edf49..ecf37c4 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -719,7 +719,7 @@ void LwpTableLayout::RegisterStyle() // If the table is not "with paragraph above" placement, create an frame style // by supertable layout if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType - && !pSuper->GetContainerLayout()->IsCell()) + && (!pSuper->GetContainerLayout() || !pSuper->GetContainerLayout()->IsCell()) ) { //with para above // pSuper->ApplyBackColor(pTableStyle); commit 7c82e36d4af8129123912dd09b5a2a8f8fb8e5fb Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 10:19:12 2015 +0000 protect against missing Ruby Marker Change-Id: I04809443b5dc50904654936e608360b57c2e85c3 (cherry picked from commit 215516a52fd01170bb4a79828b0f0948884b727a) (cherry picked from commit 6c296afad6b04328a596a92326aa50b1b480aba0) Reviewed-on: https://gerrit.libreoffice.org/20584 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit d0bda255ad97d45f68a4d1fb3dcfcf0be4d4c4bc) diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index a3295c7..47a5614 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -1242,6 +1242,8 @@ void LwpRubyLayout::ConvertContentText() void LwpRubyLayout::RegisterStyle() { LwpRubyMarker* pMarker = GetMarker(); + if (!pMarker) + throw std::runtime_error("missing Ruby Marker"); XFRubyStyle* pRubyStyle = new XFRubyStyle; commit 2d75df91d24c9eadc9f778356c5bc9d9800cd4c6 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 10:24:19 2015 +0000 guard against missing parent layout Change-Id: Ib08403edf805367c7392325fcfb66bc7ed4d6f6a (cherry picked from commit 713d737b1ff73e76c6543198ce9299e1c83ac147) (cherry picked from commit 5f469a2a1af8bff36fc3a5849a1500345febdba4) Reviewed-on: https://gerrit.libreoffice.org/20586 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 6fac6b9cd02a3f26edd800b312ceca7a1c19ee52) diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index d902a04..a3295c7 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -189,8 +189,10 @@ void LwpFrame::RegisterStyle(XFFrameStyle* pFrameStyle) */ void LwpFrame::XFConvert(XFContentContainer* pCont) { - //parse the frame which anchor to page + // parse the frame which anchor to page LwpVirtualLayout* pParent = m_pLayout->GetParentLayout(); + if (!pParent) + throw std::runtime_error("missing Parent Layout"); if(pParent->IsPage()&& pParent->GetParentLayout()->IsPage()) { //for mirror page, problems exist if the parent layout is header or footer layout, commit e7a4f50de186a2b90c067a0246e6b8cb13373e7d Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 09:42:04 2015 +0000 guard against missing Foundry Change-Id: I9147dc2bab312639a04d2e822cf99745d38d3b8d (cherry picked from commit 22ee3194c930682ad8ac7f994084e877aa00d191) Reviewed-on: https://gerrit.libreoffice.org/20574 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 479b1863a546c6022d058f27745b240dba9e1c05) diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 3eef758..5604863 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -267,8 +267,8 @@ void LwpPageLayout::ParseBackColor(XFPageMaster* pm1) void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1) { //Get the footnoteoptions for the root document - LwpDocument* pDocument = m_pFoundry->GetDocument(); - if(pDocument) + LwpDocument* pDocument = m_pFoundry ? m_pFoundry->GetDocument() : nullptr; + if (pDocument) { LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts(); commit 4e90b438937d18ea37b4d10c52fa0803893fd869 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 09:24:14 2015 +0000 protect against missing Table Layout Change-Id: Ie7f4cd2b411eb678642ea859d261b1b672752d94 (cherry picked from commit 08fe513b89ea5102a3a233ee0bac472dc8e6b219) Reviewed-on: https://gerrit.libreoffice.org/20567 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 78e612e265a4b7853ed7be9ed015cff6f64154e5) diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index 6b27d73..a587ec9 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -121,8 +121,9 @@ LwpTable * LwpCellLayout::GetTable() */ void LwpCellLayout::SetCellMap() { - // this function is called from LwpTableLayout, so it can't be NULL - GetTableLayout()->SetWordProCellMap(crowid, ccolid, this); + LwpTableLayout * pTableLayout = GetTableLayout(); + if (pTableLayout) + pTableLayout->SetWordProCellMap(crowid, ccolid, this); } /** * @short Get actual width of this cell layout commit 9069b159c9a17a9b33634038f5786211019586d5 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Dec 10 09:16:59 2015 +0000 guard against missing paragraph container Change-Id: I6ac074c7fe2821983b4a056e28fc5379f7a93974 (cherry picked from commit 130eaf02de89c8996ff6e817a005993dcbd586e6) Reviewed-on: https://gerrit.libreoffice.org/20564 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit be6ceb6dd7922c26faef12c866eeed03bc6581da) diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx index d3d7bf6..57886ab 100644 --- a/lotuswordpro/source/filter/lwppara.hxx +++ b/lotuswordpro/source/filter/lwppara.hxx @@ -345,6 +345,8 @@ inline OUString LwpPara::GetBulletStyleName() const } inline void LwpPara::AddXFContent(XFContent* pCont) { + if (!m_pXFContainer) + throw std::runtime_error("paragraph lacks container"); m_pXFContainer->Add(pCont); } inline void LwpPara::SetXFContainer(XFContentContainer* pCont) commit 3ae07c41da0287054a042ccd16af7dfeca28186f Author: David Tardon <dtar...@redhat.com> Date: Thu Dec 10 10:04:50 2015 +0100 add missing #include <stdexcept> Change-Id: I9cf72b27219489a5508786881ecd95e5820c71ac (cherry picked from commit 1ff0a3880c48227656d2b4a823cd66a6d5c74af0) Signed-off-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 7476205a8d05f1be5cc427ef884d94d86b32148c) diff --git a/lotuswordpro/source/filter/lwpobj.hxx b/lotuswordpro/source/filter/lwpobj.hxx index 99e1821..23ed6b2 100644 --- a/lotuswordpro/source/filter/lwpobj.hxx +++ b/lotuswordpro/source/filter/lwpobj.hxx @@ -67,6 +67,8 @@ #include <sal/config.h> +#include <stdexcept> + #include <salhelper/simplereferenceobject.hxx> #include "lwpheader.hxx" commit fb48608278c98d3a369b74d883c885be153c5a29 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 21:32:21 2015 +0000 guard against infinite recursion on registering styles (cherry picked from commit 66686e443b568ad5aab1b32b3f25eb73487cfef6) Reviewed-on: https://gerrit.libreoffice.org/20554 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 282b1aa32c27a513eb2858ad6e7e534ef52c1b99) Change-Id: Iabedfcce9d8ef21172e6bd0d654f3a258aae97e3 Reviewed-on: https://gerrit.libreoffice.org/20555 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit fdc0c739c0b4925485f6a8a2ece8113c895e4ca3) diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx index f23c8fc..e74d02e 100644 --- a/lotuswordpro/source/filter/lwp9reader.cxx +++ b/lotuswordpro/source/filter/lwp9reader.cxx @@ -192,7 +192,7 @@ void Lwp9Reader::ParseDocument() //Register Styles RegisteArrowStyles(); - doc->RegisterStyle(); + doc->DoRegisterStyle(); XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); pXFStyleManager->ToXml(m_pStream); diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index c5ac645..6b27d73 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -598,7 +598,7 @@ void LwpCellLayout::RegisterStyle() if (pObj.is()) { pObj->SetFoundry(m_pFoundry); - pObj->RegisterStyle(); + pObj->DoRegisterStyle(); } //register child layout style diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index e3412fc..0a3597e 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -224,7 +224,7 @@ void LwpDocument::RegisterStyle() rtl::Reference<LwpObject> pDocSock = GetSocket().obj(); if(pDocSock.is()) { - pDocSock->RegisterStyle(); + pDocSock->DoRegisterStyle(); } } /** @@ -322,7 +322,7 @@ void LwpDocument::RegisterGraphicsStyles() if(pGraphic.is()) { pGraphic->SetFoundry(m_pFoundry); - pGraphic->RegisterStyle(); + pGraphic->DoRegisterStyle(); } } /** @@ -619,7 +619,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() LwpDocument* pDivision = GetFirstDivision(); - while (pDivision) + while (pDivision && pDivision != this) { LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE(); if(pContentDivision) @@ -782,11 +782,11 @@ void LwpDocSock::RegisterStyle() { rtl::Reference<LwpObject> pDoc = GetNext().obj(); if(pDoc.is()) - pDoc->RegisterStyle(); + pDoc->DoRegisterStyle(); pDoc = GetChildHead().obj(); if(pDoc.is()) - pDoc->RegisterStyle(); + pDoc->DoRegisterStyle(); } /** * @descr parse contents of documents plugged diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx index 86ddc5f..e02c597 100644 --- a/lotuswordpro/source/filter/lwpfnlayout.cxx +++ b/lotuswordpro/source/filter/lwpfnlayout.cxx @@ -164,7 +164,7 @@ void LwpFnCellLayout::RegisterStyle() if (pObj.is()) { pObj->SetFoundry(m_pFoundry); - pObj->RegisterStyle(); + pObj->DoRegisterStyle(); } } @@ -241,7 +241,7 @@ void LwpEnSuperTableLayout::RegisterStyle() if (pTableLayout != NULL) { pTableLayout->SetFoundry(m_pFoundry); - pTableLayout->RegisterStyle(); + pTableLayout->DoRegisterStyle(); } } diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx index 5c64d00..86c69ff 100644 --- a/lotuswordpro/source/filter/lwpfootnote.cxx +++ b/lotuswordpro/source/filter/lwpfootnote.cxx @@ -181,7 +181,7 @@ void LwpFootnote::RegisterStyle() if(pContent) { pContent->SetFoundry(m_pFoundry); - pContent->RegisterStyle(); + pContent->DoRegisterStyle(); } } } diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx index d343520..3e2609f 100644 --- a/lotuswordpro/source/filter/lwpfoundry.cxx +++ b/lotuswordpro/source/filter/lwpfoundry.cxx @@ -202,7 +202,7 @@ void LwpFoundry::RegisterAllLayouts() if( pStyle.is() ) { pStyle->SetFoundry(this); - pStyle->RegisterStyle(); + pStyle->DoRegisterStyle(); } //register content page layout list: Layout @@ -210,7 +210,7 @@ void LwpFoundry::RegisterAllLayouts() if( pStyle.is() ) { pStyle->SetFoundry(this); - pStyle->RegisterStyle(); + pStyle->DoRegisterStyle(); } //Register page style layout list: PageStyle, such as "Default Page" @@ -218,7 +218,7 @@ void LwpFoundry::RegisterAllLayouts() if( pStyle.is() ) { pStyle->SetFoundry(this); - pStyle->RegisterStyle(); + pStyle->DoRegisterStyle(); } //Register FrameStyle @@ -226,7 +226,7 @@ void LwpFoundry::RegisterAllLayouts() if( pStyle.is() ) { pStyle->SetFoundry(this); - pStyle->RegisterStyle(); + pStyle->DoRegisterStyle(); } } diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index 61325da..d902a04 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -867,7 +867,7 @@ void LwpFrameLayout::RegisterStyle() if (content.is()) { content->SetFoundry(m_pFoundry); - content->RegisterStyle(); + content->DoRegisterStyle(); } //register child frame style diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx index fc16cfd..9f0161e 100644 --- a/lotuswordpro/source/filter/lwpfribframe.cxx +++ b/lotuswordpro/source/filter/lwpfribframe.cxx @@ -108,7 +108,7 @@ void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry) if (!pLayout) return; pLayout->SetFoundry(pFoundry); - pLayout->RegisterStyle(); + pLayout->DoRegisterStyle(); //register next frib text style sal_uInt8 nType = pLayout->GetRelativeType(); diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index e4bb189..8d0cce5 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -511,7 +511,7 @@ void LwpHeadLayout::RegisterStyle() OSL_FAIL("Layout points to itself"); break; } - pLayout->RegisterStyle(); + pLayout->DoRegisterStyle(); } LwpVirtualLayout *pNext = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get()); if (pNext == pLayout) diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx index 02a4de5..dd08b17 100644 --- a/lotuswordpro/source/filter/lwpnotes.cxx +++ b/lotuswordpro/source/filter/lwpnotes.cxx @@ -92,7 +92,7 @@ void LwpFribNote::RegisterNewStyle() LwpFrib::RegisterStyle(m_pPara->GetFoundry()); //register foonote style pLayout->SetFoundry(m_pPara->GetFoundry()); - pLayout->RegisterStyle(); + pLayout->DoRegisterStyle(); } } @@ -172,7 +172,7 @@ void LwpNoteLayout::RegisterStyle() if(pTextLayout) { pTextLayout->SetFoundry(GetFoundry()); - pTextLayout->RegisterStyle(); + pTextLayout->DoRegisterStyle(); } } @@ -284,7 +284,7 @@ void LwpNoteTextLayout::RegisterStyle() if(pContent.is()) { pContent->SetFoundry(GetFoundry()); - pContent->RegisterStyle(); + pContent->DoRegisterStyle(); } } diff --git a/lotuswordpro/source/filter/lwpobj.cxx b/lotuswordpro/source/filter/lwpobj.cxx index 7e15b62..010b60e 100644 --- a/lotuswordpro/source/filter/lwpobj.cxx +++ b/lotuswordpro/source/filter/lwpobj.cxx @@ -64,7 +64,7 @@ * @descr construct lwpobject from stream */ LwpObject::LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm) - : m_ObjHdr(objHdr), m_pObjStrm(NULL), m_pFoundry(NULL), m_pStrm(pStrm) + : m_ObjHdr(objHdr), m_pObjStrm(nullptr), m_pFoundry(nullptr), m_pStrm(pStrm), m_bRegisteringStyle(false) { m_pObjStrm = new LwpObjectStream(pStrm, m_ObjHdr.IsCompressed(), static_cast<sal_uInt16>(m_ObjHdr.GetSize()) ); diff --git a/lotuswordpro/source/filter/lwpobj.hxx b/lotuswordpro/source/filter/lwpobj.hxx index 942e044..99e1821 100644 --- a/lotuswordpro/source/filter/lwpobj.hxx +++ b/lotuswordpro/source/filter/lwpobj.hxx @@ -92,11 +92,22 @@ protected: LwpObjectStream* m_pObjStrm; LwpFoundry* m_pFoundry; LwpSvStream* m_pStrm; + bool m_bRegisteringStyle; protected: virtual void Read(); + virtual void RegisterStyle(); public: void QuickRead(); - virtual void RegisterStyle(); + //calls RegisterStyle but bails if DoRegisterStyle is called + //on the same object recursively + void DoRegisterStyle() + { + if (m_bRegisteringStyle) + throw std::runtime_error("recursion in styles"); + m_bRegisteringStyle = true; + RegisterStyle(); + m_bRegisteringStyle = false; + } virtual void Parse(IXFStream* pOutputStream); virtual void XFConvert(XFContentContainer* pCont); diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 08b7615..3eef758 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -884,7 +884,7 @@ void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1) //Call the RegisterStyle first to register the styles in header paras, and then XFConvert() pStory->SetFoundry(m_pFoundry); - pStory->RegisterStyle(); + pStory->DoRegisterStyle(); //, 06/27/2005 //register child layout style for framelayout, RegisterChildStyle(); @@ -1037,8 +1037,7 @@ void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1) pChangeMgr->SetHeadFootFribMap(true); pStory->SetFoundry(m_pFoundry); - pStory->RegisterStyle(); - //, 06/27/2005 + pStory->DoRegisterStyle(); //register child layout style for framelayout, RegisterChildStyle(); //End diff --git a/lotuswordpro/source/filter/lwpvpointer.cxx b/lotuswordpro/source/filter/lwpvpointer.cxx index 796e0d4..9d1a7dc 100644 --- a/lotuswordpro/source/filter/lwpvpointer.cxx +++ b/lotuswordpro/source/filter/lwpvpointer.cxx @@ -77,7 +77,7 @@ void LwpVersionedPointer::RegisterStyle() if( pObj.is() ) { pObj->SetFoundry(m_pFoundry); - pObj->RegisterStyle(); + pObj->DoRegisterStyle(); } } commit b45d0523981c7b51dbc1faafe3d705b6f3c58757 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 16:58:16 2015 +0000 bounds check GetNameByIndex like Override Change-Id: If83e255da1683779458556a3ab1af4f00b19265b (cherry picked from commit 8c67b1b51f21643036c5f5371a6af0a4558e7da2) Reviewed-on: https://gerrit.libreoffice.org/20547 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 59ced109fccf0acbaba357a96243972a5f400902) diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx index 3ee7e1b..4307d29 100644 --- a/lotuswordpro/source/filter/lwpfont.cxx +++ b/lotuswordpro/source/filter/lwpfont.cxx @@ -399,8 +399,13 @@ void LwpFontNameManager::Override(sal_uInt16 index, rtl::Reference<XFFont> co if(m_pFontNames[index-1].IsAltFaceNameOverridden()) pFont->SetFontNameAsia(m_FontTbl.GetFaceName(m_pFontNames[index-1].GetAltFaceID())); } + OUString LwpFontNameManager::GetNameByIndex(sal_uInt16 index) + //index: start from 1 { + if (index > m_nCount || index < 1) + return OUString(); + sal_uInt16 nameindex = m_pFontNames[index-1].GetFaceID(); return (m_FontTbl.GetFaceName(nameindex)); } commit 1772ef53103ed9284ee65f72d57c4aa0fabe6305 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 16:48:29 2015 +0000 guard against missing alignment property (cherry picked from commit 7e341379ecec218c0ff2ff0e8db9f14468b125f6) Reviewed-on: https://gerrit.libreoffice.org/20543 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 3b9e2bb22e782d073d8e67ae975ebb8ca5eea552) Change-Id: I1d4825c2136e516baf759f4b2c40c911547b93d7 Reviewed-on: https://gerrit.libreoffice.org/20544 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 3592f0020b3136b17f6b8289f433462563a46759) diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index c2f2f20..ed03231 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -386,18 +386,22 @@ void LwpPara::RegisterStyle() { case PP_LOCAL_ALIGN: { - if (!rParaStyle.GetAlignment()) - OverrideAlignment(NULL,static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(),pOverStyle); - else + LwpAlignmentOverride *pAlignment = static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(); + if (pAlignment) { - boost::scoped_ptr<LwpAlignmentOverride> const pAlign( - rParaStyle.GetAlignment()->clone()); - OverrideAlignment(pAlign.get(), - static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(), - pOverStyle); + if (!rParaStyle.GetAlignment()) + OverrideAlignment(nullptr, pAlignment, pOverStyle); + else + { + std::unique_ptr<LwpAlignmentOverride> const pAlign( + rParaStyle.GetAlignment()->clone()); + OverrideAlignment(pAlign.get(), + pAlignment, + pOverStyle); + } } - } break; + } case PP_LOCAL_INDENT: { noIndent = false; commit ef07e395e489648536af79c69acdd9be72b0f877 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 16:41:26 2015 +0000 guard against missing SuperTable Change-Id: Ic7cc6c807905e0c4ffbf2a3f009b27be6100cdf0 (cherry picked from commit 0cde3ca230364492aa6b7f634b97178164268728) Reviewed-on: https://gerrit.libreoffice.org/20541 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit a57ceea18a1632fb18fa57a7bb101bd3ad382415) diff --git a/lotuswordpro/source/filter/lwpfribtable.cxx b/lotuswordpro/source/filter/lwpfribtable.cxx index 4adb3ac..86c70ea 100644 --- a/lotuswordpro/source/filter/lwpfribtable.cxx +++ b/lotuswordpro/source/filter/lwpfribtable.cxx @@ -78,7 +78,9 @@ LwpSuperTableLayout* LwpFribTable::GetSuperTable() void LwpFribTable::RegisterNewStyle() { - GetSuperTable()->RegisterNewStyle(); + LwpSuperTableLayout* pSuper = GetSuperTable(); + if (pSuper) + pSuper->RegisterNewStyle(); XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle(); if(HasNextFrib()) { commit a2c8f6c31257423de0e3dc5e0fe4049bd6d59d76 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 16:31:40 2015 +0000 guard against missing paragraph story Change-Id: I217c0aedca4eadc347c103899d96c70cf9606038 (cherry picked from commit dbc830aecc722d34971d773470da478ef4c38714) Reviewed-on: https://gerrit.libreoffice.org/20539 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit d4b850fe8bc45bfb018f0a8750e09a436c49d7df) diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx index b870488..e24faf8 100644 --- a/lotuswordpro/source/filter/lwpfribsection.cxx +++ b/lotuswordpro/source/filter/lwpfribsection.cxx @@ -164,9 +164,8 @@ void LwpFribSection::ParseSection() m_pMasterPage->ParseSection(this); } } - else + else if (LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get())) { - LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() ); rtl::Reference<LwpObject> xObj(m_Section.obj()); if (xObj.is() && xObj->GetTag() == VO_INDEXSECTION) { commit cb2b390ad9e5a96a3b6118a4b263f420d428f7f1 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 16:21:38 2015 +0000 guard against missing indent property (cherry picked from commit ae94fc5b28105c920b2e9d336f463b27cae5b0e1) Reviewed-on: https://gerrit.libreoffice.org/20535 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit d9f6f9063d34f29eb44d82159c411646dc19c83f) Change-Id: I2d3369aed4b242acc936a71ee9be573c1ebc7a8f Reviewed-on: https://gerrit.libreoffice.org/20536 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 9498d2023543eba23d047b91ea25d63af41f614f) diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index 7cebb58..c2f2f20 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -401,15 +401,16 @@ void LwpPara::RegisterStyle() case PP_LOCAL_INDENT: { noIndent = false; - if (!rParaStyle.GetIndent()) - OverrideIndent(NULL,static_cast<LwpParaIndentProperty*>(pProps)->GetIndent(),pOverStyle); - - else + LwpIndentOverride *pIndent = static_cast<LwpParaIndentProperty*>(pProps)->GetIndent(); + if (pIndent) { - OverrideIndent(m_pIndentOverride,static_cast<LwpParaIndentProperty*>(pProps)->GetIndent(),pOverStyle); + if (!rParaStyle.GetIndent()) + OverrideIndent(nullptr, pIndent, pOverStyle); + else + OverrideIndent(m_pIndentOverride, pIndent, pOverStyle); } - } break; + } case PP_LOCAL_SPACING: { noSpacing = false; commit b3d4db8675f25b9361bc161e14f030e130b9c0f3 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 14:59:17 2015 +0000 guard against styles based on themselves which leads to stack exhaustion when queries, make m_BasedOnStyle private and replace it with a call to GetBasedOnStyle which checks that the base style is not itself (cherry picked from commit da5e8ba393b8522a8f7501ebeb1e9a98d544a7ba) Reviewed-on: https://gerrit.libreoffice.org/20531 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 7e5b93bf127aeb83e4ab22e0701b731ec1934253) Change-Id: I093546793755f8a3a6e8a3c23fb8565ad27b75da Reviewed-on: https://gerrit.libreoffice.org/20532 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 1ff36e1435dfb5e40ce4b651557b89c1f2c176eb) diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index 39717cd..c5ac645 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -269,7 +269,7 @@ void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle) if (!pLayoutNumerics) { // if current layout doesn't have format, go to based on layout - LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(m_BasedOnStyle.obj().get()); + LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(GetBasedOnStyle().get()); if (pCellLayout) { pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject().obj().get()); @@ -656,7 +656,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID) else { // judge base on - LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj().get()); + LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get()); if (pBase && pBase->IsProtected()) { bProtected = true; diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 3863458..e4bb189 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -648,6 +648,17 @@ void LwpMiddleLayout::Read() //end } +rtl::Reference<LwpObject> LwpMiddleLayout::GetBasedOnStyle() +{ + rtl::Reference<LwpObject> xRet(m_BasedOnStyle.obj()); + if (xRet.get() == this) + { + SAL_WARN("lwp", "style based on itself"); + return rtl::Reference<LwpObject>(); + } + return xRet; +} + #include "lwplaypiece.hxx" /** @@ -660,10 +671,9 @@ LwpLayoutGeometry* LwpMiddleLayout::GetGeometry() { return ( dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj().get()) ); } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetGeometry() : NULL; + return pLay->GetGeometry(); } return NULL; } @@ -708,11 +718,9 @@ bool LwpMiddleLayout::MarginsSameAsParent() { return LwpVirtualLayout::MarginsSameAsParent(); } - if(!m_BasedOnStyle.IsNull()) + if (LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*> (GetBasedOnStyle().get())) { - LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get()); - if (pLay) - pLay->MarginsSameAsParent(); + pLay->MarginsSameAsParent(); } return LwpVirtualLayout::MarginsSameAsParent(); @@ -747,7 +755,7 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide) return fValue; } } - LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get()); + LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get()); if(pStyle) { fValue = pStyle->GetMarginsValue(nWhichSide); @@ -773,7 +781,7 @@ double LwpMiddleLayout::GetExtMarginsValue(const sal_uInt8 &nWhichSide) return fValue; } } - LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get()); + LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get()); if(pStyle) { fValue = pStyle->GetExtMarginsValue(nWhichSide); @@ -794,10 +802,9 @@ LwpBorderStuff* LwpMiddleLayout::GetBorderStuff() LwpLayoutBorder* pLayoutBorder = dynamic_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj().get()); return pLayoutBorder ? &pLayoutBorder->GetBorderStuff() : NULL; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetBorderStuff() : NULL; + return pLay->GetBorderStuff(); } return NULL; } @@ -815,10 +822,9 @@ LwpBackgroundStuff* LwpMiddleLayout::GetBackgroundStuff() LwpLayoutBackground* pLayoutBackground = dynamic_cast<LwpLayoutBackground*>(m_LayBackgroundStuff.obj().get()); return pLayoutBackground ? &pLayoutBackground->GetBackgoudStuff() : NULL; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetBackgroundStuff() : NULL; + return pLay->GetBackgroundStuff(); } return NULL; } @@ -925,10 +931,9 @@ LwpTabOverride* LwpMiddleLayout::GetTabOverride() } return NULL; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( GetBasedOnStyle().get() )) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetTabOverride() : NULL; + return pLay->GetTabOverride(); } return NULL; } @@ -943,8 +948,9 @@ sal_uInt16 LwpMiddleLayout::GetScaleMode() { if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is()) return GetLayoutScale()->GetScaleMode(); - else if (m_BasedOnStyle.obj().is()) - return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleMode(); + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) + return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleMode(); else return (LwpLayoutScale::FIT_IN_FRAME | LwpLayoutScale::MAINTAIN_ASPECT_RATIO); } @@ -954,8 +960,9 @@ sal_uInt16 LwpMiddleLayout::GetScaleTile() if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is()) return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::TILED) ? 1 : 0; - else if (m_BasedOnStyle.obj().is()) - return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleTile(); + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) + return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleTile(); else return 0; } @@ -965,8 +972,9 @@ sal_uInt16 LwpMiddleLayout::GetScaleCenter() if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is()) return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED) ? 1 : 0; - else if (m_BasedOnStyle.obj().is()) - return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleCenter(); + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) + return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleCenter(); else return 0; } @@ -975,8 +983,9 @@ sal_uInt32 LwpMiddleLayout::GetScalePercentage() { if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is()) return GetLayoutScale()->GetScalePercentage()/10;//m_nScalePercentage 1000 = 100% - else if (m_BasedOnStyle.obj().is()) - return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScalePercentage(); + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) + return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScalePercentage(); else return 100; } @@ -985,8 +994,9 @@ double LwpMiddleLayout::GetScaleWidth() { if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is()) return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleWidth()); - else if (m_BasedOnStyle.obj().is()) - return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleWidth(); + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) + return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleWidth(); else return 0; } @@ -995,8 +1005,9 @@ double LwpMiddleLayout::GetScaleHeight() { if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is()) return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleHeight()); - else if (m_BasedOnStyle.obj().is()) - return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleHeight(); + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) + return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleHeight(); else return 0; } @@ -1051,9 +1062,10 @@ bool LwpMiddleLayout::IsSizeRightToContainer() << SHIFT_RIGHT)) == ((LAY_USEDIRECTION | LAY_TOCONTAINER | LAY_AUTOSIZE) << SHIFT_RIGHT); } - else if (m_BasedOnStyle.obj().is()) + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) { - LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj().get()); + LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(xBase.get()); return pLayout && pLayout->IsSizeRightToContainer(); } else @@ -1070,9 +1082,10 @@ bool LwpMiddleLayout::IsSizeRightToContent() << SHIFT_RIGHT)) == ((LAY_USEDIRECTION | LAY_AUTOSIZE) << SHIFT_RIGHT); } - else if (m_BasedOnStyle.obj().is()) + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + if (xBase.is()) { - LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj().get()); + LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(xBase.get()); return pLayout && pLayout->IsSizeRightToContent(); } else @@ -1162,10 +1175,9 @@ bool LwpMiddleLayout::IsAutoGrow() ((LAY_AUTOGROW << SHIFT_UP) | (LAY_AUTOGROW << SHIFT_DOWN) | (LAY_AUTOGROW << SHIFT_RIGHT) | (LAY_AUTOGROW << SHIFT_LEFT))) != 0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay && pLay->IsAutoGrow(); + return pLay->IsAutoGrow(); } return LwpVirtualLayout::IsAutoGrow(); } @@ -1180,10 +1192,9 @@ bool LwpMiddleLayout::IsAutoGrowDown() { return (m_nDirection & (LAY_AUTOGROW << SHIFT_DOWN)) != 0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay && pLay->IsAutoGrowDown(); + return pLay->IsAutoGrowDown(); } return LwpVirtualLayout::IsAutoGrowDown(); } @@ -1198,10 +1209,9 @@ bool LwpMiddleLayout::IsAutoGrowUp() { return (m_nDirection & (LAY_AUTOGROW << SHIFT_UP)) != 0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay && pLay->IsAutoGrowUp(); + return pLay->IsAutoGrowUp(); } return LwpVirtualLayout::IsAutoGrowUp(); } @@ -1216,11 +1226,9 @@ bool LwpMiddleLayout::IsAutoGrowLeft() { return (m_nDirection & (LAY_AUTOGROW << SHIFT_LEFT)) != 0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->IsAutoGrowLeft(); + return pLay->IsAutoGrowLeft(); } return LwpVirtualLayout::IsAutoGrowLeft(); } @@ -1235,10 +1243,9 @@ bool LwpMiddleLayout::IsAutoGrowRight() { return (m_nDirection & (LAY_AUTOGROW << SHIFT_RIGHT)) != 0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay && pLay->IsAutoGrowRight(); + return pLay->IsAutoGrowRight(); } return LwpVirtualLayout::IsAutoGrowRight(); } @@ -1256,11 +1263,9 @@ sal_uInt8 LwpMiddleLayout::GetContentOrientation() if (pLayGeometry) return pLayGeometry->GetContentOrientation(); } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->GetContentOrientation(); + return pLay->GetContentOrientation(); } return LwpVirtualLayout::GetContentOrientation(); } @@ -1291,11 +1296,9 @@ bool LwpMiddleLayout::HonorProtection() } } } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->HonorProtection(); + return pLay->HonorProtection(); } return LwpVirtualLayout::HonorProtection(); @@ -1312,10 +1315,9 @@ bool LwpMiddleLayout::IsProtected() { bProtected = (m_nAttributes & STYLE_PROTECTED)!=0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - bProtected = pLay && pLay->IsProtected(); + bProtected = pLay->IsProtected(); } else bProtected = LwpVirtualLayout::IsProtected(); @@ -1438,10 +1440,9 @@ bool LwpMiddleLayout::GetUsePrinterSettings() { return (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get())) { - LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay && pLay->GetUsePrinterSettings(); + return pLay->GetUsePrinterSettings(); } return false; } @@ -1518,8 +1519,8 @@ sal_uInt16 LwpLayout::GetNumCols() } } - LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get()); - if(pStyle) + LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (GetBasedOnStyle().get()); + if (pStyle) { return pStyle->GetNumCols(); } @@ -1543,8 +1544,8 @@ double LwpLayout::GetColWidth(sal_uInt16 nIndex) } } - LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get()); - if(pStyle) + LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get()); + if (pStyle) { return pStyle->GetColWidth(nIndex); } @@ -1568,8 +1569,8 @@ double LwpLayout::GetColGap(sal_uInt16 nIndex) } } - LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get()); - if(pStyle) + LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get()); + if (pStyle) { return pStyle->GetColGap(nIndex); } @@ -1713,10 +1714,9 @@ sal_uInt16 LwpLayout::GetUsePage() else return 0; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get())) { - LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetUsePage() : 0; + return pLay->GetUsePage(); } return 0; } @@ -1731,10 +1731,9 @@ LwpUseWhen* LwpLayout::VirtualGetUseWhen() { return m_pUseWhen; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get())) { - LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->VirtualGetUseWhen() : NULL; + return pLay->VirtualGetUseWhen(); } return LwpVirtualLayout::VirtualGetUseWhen(); } @@ -1753,11 +1752,9 @@ bool LwpLayout::IsUseOnAllPages() else return false; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get())) { - LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->IsUseOnAllPages(); + return pLay->IsUseOnAllPages(); } return LwpVirtualLayout::IsUseOnAllPages(); } @@ -1776,11 +1773,9 @@ bool LwpLayout::IsUseOnAllEvenPages() else return false; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get())) { - LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->IsUseOnAllEvenPages(); + return pLay->IsUseOnAllEvenPages(); } return LwpVirtualLayout::IsUseOnAllEvenPages(); } @@ -1799,11 +1794,9 @@ bool LwpLayout::IsUseOnAllOddPages() else return false; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get())) { - LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->IsUseOnAllOddPages(); + return pLay->IsUseOnAllOddPages(); } return LwpVirtualLayout::IsUseOnAllOddPages(); } @@ -1822,11 +1815,9 @@ bool LwpLayout::IsUseOnPage() else return false; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get())) { - LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->IsUseOnPage(); + return pLay->IsUseOnPage(); } return LwpVirtualLayout::IsUseOnPage(); } @@ -1844,10 +1835,9 @@ LwpShadow* LwpLayout::GetShadow() LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj().get()); return pLayoutShadow ? &pLayoutShadow->GetShadow() : NULL; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get())) { - LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetShadow() : NULL; + return pLay->GetShadow(); } return NULL; } @@ -1991,11 +1981,9 @@ sal_uInt8 LwpPlacableLayout::GetWrapType() { return m_nWrapType; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(GetBasedOnStyle().get())) { - LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj().get() ); - if (pLay) - return pLay->GetWrapType(); + return pLay->GetWrapType(); } return LAY_WRAP_AROUND; } @@ -2014,10 +2002,9 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get()); } } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(GetBasedOnStyle().get())) { - LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetRelativityPiece() : NULL; + return pLay->GetRelativityPiece(); } return NULL; } @@ -2056,10 +2043,9 @@ sal_Int32 LwpPlacableLayout::GetBaseLineOffset() { return m_nBaseLineOffset; } - else if( !m_BasedOnStyle.IsNull() ) + else if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(GetBasedOnStyle().get())) { - LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj().get() ); - return pLay ? pLay->GetBaseLineOffset() : 0; + return pLay->GetBaseLineOffset(); } return 0; diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index b213bfc..5e9b42e 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -328,6 +328,8 @@ public: protected: void Read() SAL_OVERRIDE; +private: + LwpObjectID m_BasedOnStyle; protected: enum { @@ -336,8 +338,7 @@ protected: }; LwpObjectID m_Content; - LwpObjectID m_BasedOnStyle; - + rtl::Reference<LwpObject> GetBasedOnStyle(); LwpObjectID m_TabPiece; LwpLayoutStyle* m_pStyleStuff; LwpLayoutMisc* m_pMiscStuff; diff --git a/lotuswordpro/source/filter/lwpobjid.cxx b/lotuswordpro/source/filter/lwpobjid.cxx index 0962f37..2fd57e9 100644 --- a/lotuswordpro/source/filter/lwpobjid.cxx +++ b/lotuswordpro/source/filter/lwpobjid.cxx @@ -187,12 +187,12 @@ sal_uInt32 LwpObjectID::DiskSizeIndexed() const */ rtl::Reference<LwpObject> LwpObjectID::obj(VO_TYPE tag) const { - LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); - LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory(); - if(IsNull()) + if (IsNull()) { return NULL; } + LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); + LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory(); rtl::Reference<LwpObject> pObj = pObjMgr->QueryObject(*this); if( tag!=VO_INVALID && (pObj.is()) ) { commit 54b97c6984fc6e93d9966ea305a158be4a3c6dd3 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 13:30:02 2015 +0000 guard against no default text style Change-Id: I7416d709de79ae88cf4a9546d8adfecec9935238 (cherry picked from commit 80297dd0f21bfeaa9bae09cacfa29ab2eee64c09) Reviewed-on: https://gerrit.libreoffice.org/20529 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit da794ce092673fcfd1311cb9a218098a400682e3) diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx index 16f8737..dfb4178 100644 --- a/lotuswordpro/source/filter/lwptoc.cxx +++ b/lotuswordpro/source/filter/lwptoc.cxx @@ -130,7 +130,8 @@ void LwpTocSuperLayout::RegisterStyle() LwpSuperTableLayout::RegisterStyle(); // Get font info of default text style and set into tab style - XFParaStyle* pBaseStyle = static_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*m_pFoundry->GetDefaultTextStyle())); + const LwpObjectID *pDefaultTextStyle = m_pFoundry->GetDefaultTextStyle(); + XFParaStyle* pBaseStyle = pDefaultTextStyle ? static_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*pDefaultTextStyle)) : nullptr; XFTextStyle*pTextStyle = new XFTextStyle; if (pBaseStyle) pTextStyle->SetFont(pBaseStyle->GetFont()); // who delete this font????? commit 410bd50600a1d087b39bfe5be5dbc3da48273408 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 13:10:27 2015 +0000 guard against missing paragraph Story Change-Id: Iae617e9731dbdcedf8aa6bf02977911dce60bdd0 (cherry picked from commit 9d2a1c48b4a39967bc21776b471f1a4eca735cb6) Reviewed-on: https://gerrit.libreoffice.org/20526 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 7a721b415564ae0b0c203bcaf9a24d03a4238a44) diff --git a/lotuswordpro/source/filter/lwpfribptr.cxx b/lotuswordpro/source/filter/lwpfribptr.cxx index 4f3211a..79486a2 100644 --- a/lotuswordpro/source/filter/lwpfribptr.cxx +++ b/lotuswordpro/source/filter/lwpfribptr.cxx @@ -269,9 +269,9 @@ void LwpFribPtr::XFConvert() case FRIB_TAG_HARDSPACE: { OUString sHardSpace(sal_Unicode(0x00a0)); - LwpHyperlinkMgr* pHyperlink = - m_pPara->GetStory()->GetHyperlinkMgr(); - if (pHyperlink->GetHyperlinkFlag()) + LwpStory *pStory = m_pPara->GetStory(); + LwpHyperlinkMgr* pHyperlink = pStory ? pStory->GetHyperlinkMgr() : nullptr; + if (pHyperlink && pHyperlink->GetHyperlinkFlag()) pFrib->ConvertHyperLink(m_pXFPara,pHyperlink,sHardSpace); else pFrib->ConvertChars(m_pXFPara,sHardSpace); commit 348ba66bec2804325a69979016b7148dc187804e Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 13:00:24 2015 +0000 guard against missing BaseStyle Change-Id: I173b12f0a28f917f24d1923e531da1b798beb1f6 (cherry picked from commit d34cbe279cc8e1db941a4da1130d5a6d7429357d) Reviewed-on: https://gerrit.libreoffice.org/20523 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 1f052fb8867da4a87f7c3d51eaeae6f680934d19) diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx index 75b9aa7..16f8737 100644 --- a/lotuswordpro/source/filter/lwptoc.cxx +++ b/lotuswordpro/source/filter/lwptoc.cxx @@ -132,7 +132,8 @@ void LwpTocSuperLayout::RegisterStyle() // Get font info of default text style and set into tab style XFParaStyle* pBaseStyle = static_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*m_pFoundry->GetDefaultTextStyle())); XFTextStyle*pTextStyle = new XFTextStyle; - pTextStyle->SetFont(pBaseStyle->GetFont()); // who delete this font????? + if (pBaseStyle) + pTextStyle->SetFont(pBaseStyle->GetFont()); // who delete this font????? XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); m_TabStyleName = pXFStyleManager->AddStyle(pTextStyle).m_pStyle->GetStyleName(); commit 7e106354f7b14adfb8c4446d8b1683c2a97fc124 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 12:50:57 2015 +0000 guard against missing Section Change-Id: Id5295d294b56d6504d962ee1941a350a595031e7 (cherry picked from commit c8b4fe55b8b50fc33a9157e93b42aed0f7d30534) Reviewed-on: https://gerrit.libreoffice.org/20520 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 74a030fb0a90da422f650772da49348ccd84b0b0) diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx index f66b00f..b870488 100644 --- a/lotuswordpro/source/filter/lwpfribsection.cxx +++ b/lotuswordpro/source/filter/lwpfribsection.cxx @@ -167,7 +167,8 @@ void LwpFribSection::ParseSection() else { LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() ); - if (m_Section.obj()->GetTag() == VO_INDEXSECTION) + rtl::Reference<LwpObject> xObj(m_Section.obj()); + if (xObj.is() && xObj->GetTag() == VO_INDEXSECTION) { //create a new section and add it to container XFIndex* pIndex = new XFIndex; commit 738f904532ab56b2864d0719af62d11f2b3f76b8 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 12:41:48 2015 +0000 guard against missing RootDocument Change-Id: I1c6b58b58ab489a17419dbf7cd4ecec63359b7f3 (cherry picked from commit 0f700d5bc9c0ebc1e1ebe60758fbbf02590790bc) Reviewed-on: https://gerrit.libreoffice.org/20516 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 2e34ce925aba7ffbb61ab909fd77722cb192eae9) diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index a2ff123..e3412fc 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -634,8 +634,8 @@ LwpDocument* LwpDocument::GetPreviousDivision() LwpDocument* LwpDocument::GetLastDivisionThatHasEndnote() { LwpDocument* pRoot = GetRootDocument(); - LwpDocument *pLastDoc = pRoot->GetLastDivisionWithContents(); - while(pLastDoc) + LwpDocument *pLastDoc = pRoot ? pRoot->GetLastDivisionWithContents() : nullptr; + while (pLastDoc) { if(pLastDoc->GetEnSuperTableLayout()) return pLastDoc; commit c008f5d5d890632db2e360ee16c25a665eb514ab Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 12:33:36 2015 +0000 protect against missing Modifiers Change-Id: I226f67c6c49bfcbc1fa0ef40fc9f7d5548fa043b (cherry picked from commit 6c59adca37900dccc394061a730984ecb180aacf) Reviewed-on: https://gerrit.libreoffice.org/20511 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 02244358dc3021cb23dcb12e06594c1c6f3b0e42) diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx index c6eb252..c9ad2d8 100644 --- a/lotuswordpro/source/filter/lwppara1.cxx +++ b/lotuswordpro/source/filter/lwppara1.cxx @@ -241,7 +241,7 @@ void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering) { if ( (pFrib->GetNext() && pFrib->GetNext()->GetType() == FRIB_TAG_TEXT) || - (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels) + (pFrib->GetModifiers() && pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels) ) { pParaNumbering->pSuffix = static_cast<LwpFribText*>(pFrib); commit c1afea83925e2830392fef18402120a0a76f278f Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 12:23:11 2015 +0000 protect against missing SuperTable Change-Id: I788ec28424bb638f727901b7d25e48a284ab67d0 (cherry picked from commit 356109d4ead137ea22b358b20ed22a4bd09d35f6) Reviewed-on: https://gerrit.libreoffice.org/20508 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit dbb30e5ab13e75fb187431e3678b70dd9830594a) diff --git a/lotuswordpro/source/filter/lwpfribtable.cxx b/lotuswordpro/source/filter/lwpfribtable.cxx index edd73da..4adb3ac 100644 --- a/lotuswordpro/source/filter/lwpfribtable.cxx +++ b/lotuswordpro/source/filter/lwpfribtable.cxx @@ -98,6 +98,8 @@ void LwpFribTable::XFConvert(XFContentContainer* pCont) { XFContentContainer* pXFContentContainer = pCont; LwpSuperTableLayout* pSuper = GetSuperTable(); + if (!pSuper) + return; sal_uInt8 nType = pSuper->GetRelativeType(); LwpVirtualLayout* pContainer = pSuper->GetContainerLayout(); if (!pContainer) commit 0bb9a0dfd2d0d3041fb6cb058a12ba770e8ed225 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 12:09:37 2015 +0000 guard against corrupt SilverBullet (cherry picked from commit 36d55980b1b3498fecc460d3c46667e5f5a17b8e) Reviewed-on: https://gerrit.libreoffice.org/20504 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit d387a99fce3f96f4fcd60c70909292255f12840f) Change-Id: I3af47ab3af5e28a865a77a592f6a92edb46e4f2b Reviewed-on: https://gerrit.libreoffice.org/20505 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 4f78f0cca72ccd011c6e0af9225fb7b9004eac47) diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx index c0c39e9..e7ad33f 100644 --- a/lotuswordpro/source/filter/lwpsilverbullet.cxx +++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx @@ -97,7 +97,10 @@ void LwpSilverBullet::Read() sal_uInt16 nNumPos = m_pObjStrm->QuickReaduInt16(); - for (sal_uInt8 nC = 0; nC < nNumPos; nC++) + if (nNumPos > SAL_N_ELEMENTS(m_pResetPositionFlags)) + throw std::range_error("corrupt SilverBullet"); + + for (sal_uInt16 nC = 0; nC < nNumPos; nC++) m_pResetPositionFlags[nC] = m_pObjStrm->QuickReaduInt8(); m_nUseCount = m_pObjStrm->QuickReaduInt32(); commit 7ec3edb9729c908fb2f3dad0d15e7e32b5bdac2d Author: Andras Timar <andras.ti...@collabora.com> Date: Wed Dec 9 12:50:19 2015 +0100 tdf#96353 make spell options dialog resizable Change-Id: I2e9ef88d471f8fa379a03f7b6b95bf14ce172acb Reviewed-on: https://gerrit.libreoffice.org/20499 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit ccb28049c1420b17a84aa89eee207af4cc517039) diff --git a/cui/uiconfig/ui/spelloptionsdialog.ui b/cui/uiconfig/ui/spelloptionsdialog.ui index 527fc4f..29c6add 100644 --- a/cui/uiconfig/ui/spelloptionsdialog.ui +++ b/cui/uiconfig/ui/spelloptionsdialog.ui @@ -6,7 +6,6 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes">Options</property> - <property name="resizable">False</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> commit 7e6f42bf5bbf5496ba90653b08693344f6ca9275 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 11:56:52 2015 +0000 guard against corrupt ObjIndexData Change-Id: I214991e5d34c8e335cdd8ea482f8fa4913ba637b (cherry picked from commit c88a23b9d44118e96de41a70ab7f87eb0aafb126) Reviewed-on: https://gerrit.libreoffice.org/20502 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 64070e8f3ec976f48e233064795eff756b6d5146) diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx index d6720e7..43208ab 100644 --- a/lotuswordpro/source/filter/lwpidxmgr.cxx +++ b/lotuswordpro/source/filter/lwpidxmgr.cxx @@ -215,7 +215,7 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm) vObjIndexs[k]->offset = pObjStrm->QuickReaduInt32(); for (k = 0; k < LeafCount; k++) - m_TempVec[k] = pObjStrm->QuickReaduInt32(); + m_TempVec.at(k) = pObjStrm->QuickReaduInt32(); } for( sal_uInt16 j=0; j<LeafCount; j++ ) diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx index 7f61cdf..edbd562 100644 --- a/lotuswordpro/source/filter/lwpobjstrm.cxx +++ b/lotuswordpro/source/filter/lwpobjstrm.cxx @@ -170,7 +170,7 @@ sal_uInt16 LwpObjectStream::QuickRead(void* buf, sal_uInt16 len) memset(buf, 0, len); if( len > m_nBufSize - m_nReadPos ) { - assert(false); + SAL_WARN("lwp", "read request longer than buffer"); len = m_nBufSize - m_nReadPos; } if( m_pContentBuf && len) commit eecf8d4eb9c08e1101f44a13b8b4b49cdeabbae2 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Dec 9 11:28:52 2015 +0000 guard against corrupt RootData Change-Id: Iad2788a7e5e7ee3b3107eab37cde2d3d38eae005 (cherry picked from commit fc943ea85a7924ce0552b08eef99ed8e02f0b965) Reviewed-on: https://gerrit.libreoffice.org/20496 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> (cherry picked from commit 21e0778bcbb2d90e471f59166e74c00aa044a1df) diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx index 07ea4a1..d6720e7 100644 --- a/lotuswordpro/source/filter/lwpidxmgr.cxx +++ b/lotuswordpro/source/filter/lwpidxmgr.cxx @@ -154,7 +154,10 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm) sal_uInt16 KeyCount = pObjStrm->QuickReaduInt16(); m_nLeafCount = KeyCount ? KeyCount + 1 : 0; - if(KeyCount) + if (m_nLeafCount > SAL_N_ELEMENTS(m_ChildIndex)) + throw std::range_error("corrupt RootData"); + + if (KeyCount) { //read object keys LwpKey* akey = new LwpKey(); diff --git a/lotuswordpro/source/filter/lwptabrack.cxx b/lotuswordpro/source/filter/lwptabrack.cxx index 0dac754..487d387 100644 --- a/lotuswordpro/source/filter/lwptabrack.cxx +++ b/lotuswordpro/source/filter/lwptabrack.cxx @@ -92,7 +92,7 @@ void LwpTabRack::Read() m_nNumTabs = m_pObjStrm->QuickReaduInt16(); if (m_nNumTabs > MaxTabs) - throw std::out_of_range("corrupt LwpTabRack"); + throw std::range_error("corrupt LwpTabRack"); for (int i=0; i<m_nNumTabs; ++i) { m_aTabs[i].Read(m_pObjStrm);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits