cui/source/dialogs/iconcdlg.cxx | 6 +- cui/source/tabpages/swpossizetabpage.cxx | 2 desktop/unx/source/splashx.c | 8 ++- filter/source/msfilter/svdfppt.cxx | 58 ++++++++++++++-------------- include/test/testinteractionhandler.hxx | 1 lotuswordpro/source/filter/lwpparastyle.cxx | 2 sc/source/filter/excel/xiescher.cxx | 2 sc/source/filter/lotus/op.cxx | 2 sc/source/ui/view/output2.cxx | 3 + sd/source/ui/func/fuolbull.cxx | 3 - sfx2/source/dialog/tabdlg.cxx | 2 sot/source/sdstor/stgole.cxx | 2 svl/qa/unit/items/test_itempool.cxx | 4 + svx/source/unodraw/UnoGraphicExporter.cxx | 4 - svx/source/unodraw/unopage.cxx | 17 +++----- sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 3 - sw/qa/extras/uiwriter/uiwriter.cxx | 8 ++- sw/source/core/crsr/findtxt.cxx | 6 +- sw/source/core/doc/fmtcol.cxx | 12 ++--- sw/source/core/inc/frame.hxx | 15 +++---- sw/source/filter/basflt/fltshell.cxx | 4 - sw/source/uibase/docvw/srcedtw.cxx | 1 sw/source/uibase/uno/unotxdoc.cxx | 2 vcl/source/outdev/polyline.cxx | 2 24 files changed, 92 insertions(+), 77 deletions(-)
New commits: commit 0dace9ec07447407df5146555b1c8b56c0afe1e1 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 17:25:14 2017 +0000 coverity#1399047 Untrusted loop bound Change-Id: I1c4c4613349935c803d1cf7729c52a3a18ee5375 diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index dd0057e..7d0b47d 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -618,7 +618,7 @@ void OP_ApplyPatternArea123(LotusContext& rContext, SvStream& rStream) rStream.ReadUInt16( nData ); rStream.SeekRel( nLength - 2 ); if( nLevel == 1 ) - nTabCount = nData; + nTabCount = SanitizeTab(nData); else if( nLevel == 2 ) { nCol = nCol + nColCount; commit f5c1909f042faf59ac4fd2462e18acf21ff577ec Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 16:28:48 2017 +0000 coverity#1399043 Resource leak Change-Id: I11c23a02241712bbbae62c4716d0ca48c0436107 diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index af09b9d..0c06194 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -6744,46 +6744,46 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport { ReadDffRecordHeader( rIn, aTextHd ); sal_uInt16 nVal = 0; - PPTFieldEntry* pEntry = nullptr; + std::unique_ptr<PPTFieldEntry> xEntry; switch ( aTextHd.nRecType ) { case PPT_PST_DateTimeMCAtom : { - pEntry = new PPTFieldEntry; - rIn.ReadUInt16( pEntry->nPos ) + xEntry.reset(new PPTFieldEntry); + rIn.ReadUInt16(xEntry->nPos) .ReadUInt16( nVal ) .ReadUInt16( nVal ); - pEntry->SetDateTime( nVal & 0xff ); + xEntry->SetDateTime( nVal & 0xff ); } break; case PPT_PST_FooterMCAtom : { - pEntry = new PPTFieldEntry; - rIn.ReadUInt16( pEntry->nPos ); - pEntry->pField1 = new SvxFieldItem( SvxFooterField(), EE_FEATURE_FIELD ); + xEntry.reset(new PPTFieldEntry); + rIn.ReadUInt16(xEntry->nPos); + xEntry->pField1 = new SvxFieldItem( SvxFooterField(), EE_FEATURE_FIELD ); } break; case PPT_PST_HeaderMCAtom : { - pEntry = new PPTFieldEntry; - rIn.ReadUInt16( pEntry->nPos ); - pEntry->pField1 = new SvxFieldItem( SvxHeaderField(), EE_FEATURE_FIELD ); + xEntry.reset(new PPTFieldEntry); + rIn.ReadUInt16(xEntry->nPos); + xEntry->pField1 = new SvxFieldItem( SvxHeaderField(), EE_FEATURE_FIELD ); } break; case PPT_PST_GenericDateMCAtom : { - pEntry = new PPTFieldEntry; - rIn.ReadUInt16( pEntry->nPos ); - pEntry->pField1 = new SvxFieldItem( SvxDateTimeField(), EE_FEATURE_FIELD ); + xEntry.reset(new PPTFieldEntry); + rIn.ReadUInt16(xEntry->nPos); + xEntry->pField1 = new SvxFieldItem( SvxDateTimeField(), EE_FEATURE_FIELD ); if ( rPersistEntry.pHeaderFooterEntry ) // sj: #i34111# on master pages it is possible { // that there is no HeaderFooterEntry available if ( rPersistEntry.pHeaderFooterEntry->nAtom & 0x20000 ) // auto date time - pEntry->SetDateTime( rPersistEntry.pHeaderFooterEntry->nAtom & 0xff ); + xEntry->SetDateTime( rPersistEntry.pHeaderFooterEntry->nAtom & 0xff ); else - pEntry->pString = new OUString( rPersistEntry.pHeaderFooterEntry->pPlaceholder[ nVal ] ); + xEntry->pString = new OUString( rPersistEntry.pHeaderFooterEntry->pPlaceholder[ nVal ] ); } } break; @@ -6791,10 +6791,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport case PPT_PST_SlideNumberMCAtom : case PPT_PST_RTFDateTimeMCAtom : { - pEntry = new PPTFieldEntry; + xEntry.reset(new PPTFieldEntry); if ( aTextHd.nRecLen >= 4 ) { - rIn.ReadUInt16( pEntry->nPos ) + rIn.ReadUInt16(xEntry->nPos) .ReadUInt16( nVal ); // evaluate ID @@ -6802,7 +6802,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport switch( aTextHd.nRecType ) { case PPT_PST_SlideNumberMCAtom: - pEntry->pField1 = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ); + xEntry->pField1 = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ); break; case PPT_PST_RTFDateTimeMCAtom: @@ -6835,7 +6835,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport else if (!n) { // End of format string - pEntry->pString = new OUString( aStr ); + xEntry->pString = new OUString( aStr ); break; } else if (!inquote) @@ -6851,10 +6851,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport } } } - if ( pEntry->pString == nullptr ) + if (!xEntry->pString) { // Handle as previously - pEntry->pField1 = new SvxFieldItem( SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD ); + xEntry->pField1 = new SvxFieldItem( SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD ); } } } @@ -6887,16 +6887,16 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport .ReadUInt32( nEndPos ); if ( nEndPos ) { - pEntry = new PPTFieldEntry; - pEntry->nPos = (sal_uInt16)nStartPos; - pEntry->nTextRangeEnd = (sal_uInt16)nEndPos; + xEntry.reset(new PPTFieldEntry); + xEntry->nPos = (sal_uInt16)nStartPos; + xEntry->nTextRangeEnd = (sal_uInt16)nEndPos; OUString aTarget( pHyperlink->aTarget ); if ( !pHyperlink->aConvSubString.isEmpty() ) { aTarget += "#"; aTarget += pHyperlink->aConvSubString; } - pEntry->pField1 = new SvxFieldItem( SvxURLField( aTarget, OUString(), SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); + xEntry->pField1 = new SvxFieldItem( SvxURLField( aTarget, OUString(), SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); } } break; @@ -6908,19 +6908,19 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport } if (!aTextHd.SeekToEndOfRecord(rIn)) break; - if ( pEntry ) + if (xEntry) { // sorting fields ( hi >> lo ) ::std::vector< PPTFieldEntry* >::iterator it = FieldList.begin(); for( ; it != FieldList.end(); ++it ) { - if ( (*it)->nPos < pEntry->nPos ) { + if ( (*it)->nPos < xEntry->nPos ) { break; } } if ( it != FieldList.end() ) { - FieldList.insert( it, pEntry ); + FieldList.insert(it, xEntry.release()); } else { - FieldList.push_back( pEntry ); + FieldList.push_back(xEntry.release()); } } } commit 05e99b1c05b4cb96cf3d3c363da3f8631fa84b67 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 16:14:51 2017 +0000 coverity#1399016 Logically dead code Change-Id: Ib3f0ca4d07dffb568287bcd6a283ab4e529519ff diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c index 454755b..7166738 100644 --- a/desktop/unx/source/splashx.c +++ b/desktop/unx/source/splashx.c @@ -307,14 +307,18 @@ static void create_pixmap(struct splash* splash) } else if ( bpp == 24 ) { - if ( machine_byte_order == byte_order && byte_order == LSBFirst ) + if (machine_byte_order == byte_order) + { +#if defined OSL_LITENDIAN COPY_IN_OUT( 3, memcpy(out, &pixel, sizeof (color_t)); out += 3; ) - else if ( machine_byte_order == byte_order && byte_order == MSBFirst ) +#else /* OSL_BIGENDIAN */ COPY_IN_OUT( 3, tmp = pixel; *( (uint8_t *)out ) = *( (uint8_t *)(&tmp) + 1 ); *( (uint8_t *)out + 1 ) = *( (uint8_t *)(&tmp) + 2 ); *( (uint8_t *)out + 2 ) = *( (uint8_t *)(&tmp) + 3 ); out += 3; ) +#endif + } else COPY_IN_OUT( 3, tmp = pixel; *( (uint8_t *)out ) = *( (uint8_t *)(&tmp) + 3 ); commit 9ad08b403be9c6646cda9a379332545c3668975b Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 16:07:46 2017 +0000 coverity#1399031 golden, Out-of-bounds read There are 17 elements, so SAL_N_ELEMENTS(sppnPatterns) is 17 The largest valid index is 16, not 17, so valid max index is out by one Change-Id: Id20218a0e73cb9e502a631fa6bfbb3f0a22c4727 diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index ab28bc7..2d3221a 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -701,7 +701,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 }, { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 } }; - const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, SAL_N_ELEMENTS( sppnPatterns ) ) ]; + const sal_uInt8* const pnPattern = sppnPatterns[std::min<size_t>(rFillData.mnPattern - 2, SAL_N_ELEMENTS(sppnPatterns) - 1)]; // create 2-colored 8x8 DIB SvMemoryStream aMemStrm; aMemStrm.WriteUInt32( 12 ).WriteInt16( 8 ).WriteInt16( 8 ).WriteUInt16( 1 ).WriteUInt16( 1 ); commit c17b739badaf316ef05671edb927ecdb040a76cd Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 16:00:10 2017 +0000 coverity#704601 Dereference after null check Change-Id: Icfef8f4ded311790a90b61b37c08254592d979ab diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index 265e10a..661d3d5 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -463,7 +463,8 @@ void IconChoiceDialog::DeActivatePageImpl () if ( ( DeactivateRC::LeavePage & nRet ) && aTmp.Count() ) { - pExampleSet->Put( aTmp ); + if (pExampleSet) + pExampleSet->Put(aTmp); pOutSet->Put( aTmp ); } } commit bf48d61f87647a425f50409b11f3ac8e681b14d4 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:59:27 2017 +0000 coverity#704602 Dereference after null check Change-Id: I069716ad675a217ecd97aee6b07346cf838fd653 diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index d58c488..265e10a 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -703,7 +703,8 @@ void IconChoiceDialog::Ok() if ( pPage->FillItemSet( &aTmp ) ) { - pExampleSet->Put( aTmp ); + if (pExampleSet) + pExampleSet->Put(aTmp); pOutSet->Put( aTmp ); } } commit a83f0c98610bae4eac5cdaf87eddfbeb3a3388f4 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:52:04 2017 +0000 coverity#1399027 Dereference after null check Change-Id: I6006e98ea45a8326899c0afb7c39b0062fd27220 diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index d3efaae..19b8985 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -1169,7 +1169,7 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl, bool ) else nRet = pPage->DeactivatePage( nullptr ); if ( ( DeactivateRC::LeavePage & nRet ) == DeactivateRC::LeavePage && - aTmp.Count() ) + aTmp.Count() && m_pExampleSet) { m_pExampleSet->Put( aTmp ); m_pOutSet->Put( aTmp ); commit 08f38d591e4fafe2d739d34089b659c478aae447 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:47:49 2017 +0000 coverity#1399024 Explicit null dereferenced Change-Id: I9e8f4bf693734625ec3544e5d4f35a7d048ea609 diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index 7a28dbc..5b01301 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -266,7 +266,8 @@ void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq) { mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? nullptr : pNumRule ); } - if ( bInMasterView ) + + if (bInMasterView && pNumRule) { SfxItemSet aSetAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END ); aSetAttr.Put(SvxNumBulletItem( *pNumRule, nNumItemId )); commit 975b29301727cbfa479a0fde628315ecb0cfb2f0 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:45:03 2017 +0000 coverity#1399025 Dereference after null check Change-Id: I58ccfeb03388a60a6e2a506a22490ada5feb669f diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 83c1cac..f2aa34c 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -1059,24 +1059,23 @@ inline bool SwFrame::IsAccessibleFrame() const class SwFrameDeleteGuard { private: - SwFrame *m_pFrame; - bool m_bOldDeleteAllowed; + SwFrame *m_pForbidFrame; public: //Flag pFrame for SwFrameDeleteGuard lifetime that we shouldn't delete //it in e.g. SwSectionFrame::MergeNext etc because we will need it //again after the SwFrameDeleteGuard dtor explicit SwFrameDeleteGuard(SwFrame* pFrame) - : m_pFrame(pFrame) + : m_pForbidFrame((pFrame && !pFrame->IsDeleteForbidden()) ? + pFrame : nullptr) { - m_bOldDeleteAllowed = m_pFrame && !m_pFrame->IsDeleteForbidden(); - if (m_bOldDeleteAllowed) - m_pFrame->ForbidDelete(); + if (m_pForbidFrame) + m_pForbidFrame->ForbidDelete(); } ~SwFrameDeleteGuard() { - if (m_bOldDeleteAllowed) - m_pFrame->AllowDelete(); + if (m_pForbidFrame) + m_pForbidFrame->AllowDelete(); } }; commit 7be62f8ceb864e9560a959006381d95bb8febfc6 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:34:55 2017 +0000 coverity#1399026 Unchecked dynamic_cast Change-Id: I60188c36bdd6d44c5bd8dae28debafc10b6c9f3b diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index a576ce3..fd0909e 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3858,6 +3858,7 @@ void SwUiWriterTest::testTdf84695Tab() // Now pressing 'tab' should jump to the other shape. SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pXTextDocument); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_TAB); commit 9a29cd7d26ccdd97b728a4c837c58624770122eb Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:33:48 2017 +0000 coverity#1399023 Unchecked dynamic_cast Change-Id: Id5d0a3cca9587f577000244a9776d7f1f61b5487 diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 0891bba..d880e48 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -211,7 +211,7 @@ static SwPrintUIOptions * lcl_GetPrintUIOptions( { sal_uInt16 nMax = nCurrentPage; const SwPageFrame *pPage = dynamic_cast<const SwPageFrame*>(pFrame->Lower()); - for ( ; nMax-- > 0; ) + while (pPage && nMax-- > 0) { if (pPage->Frame().Height() == 0) nCurrentPage--; commit 571096ab8f6ffe605c50bb92a1683d79742b1520 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:30:27 2017 +0000 coverity#1399022 Dereference after null check Change-Id: I33c2007a8caf4f0c83cfe1119bba828f6a7c7c29 diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 803df6a..7d8745ec 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -690,8 +690,8 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, delete pTOXAttr->GetBase(); // set (above saved and removed) the break item at the node following the TOX - if( aBkSet.Count() ) - pNd->SetAttr( aBkSet ); + if (pNd && aBkSet.Count()) + pNd->SetAttr(aBkSet); } break; case RES_FLTR_REDLINE: commit c15695a998157e07cc3f248d72763048af28b623 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:29:17 2017 +0000 coverity#1399021 Unchecked dynamic_cast Change-Id: I2b43a918f8f01bbe075c2edd8ca963e13588903c diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 2a852fc..0be6470 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -721,9 +721,9 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, // create a view std::unique_ptr< SdrView > pView; - if( dynamic_cast<FmFormModel*>( mpDoc ) != nullptr ) + if (FmFormModel *pFormModel = dynamic_cast<FmFormModel*>(mpDoc)) { - pView.reset(new FmFormView( dynamic_cast<FmFormModel*>( mpDoc ), aVDev ) ); + pView.reset(new FmFormView(pFormModel, aVDev)); } else { commit 2fc13fef1478925f5ea447b3b293c2e36c0c6696 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:27:53 2017 +0000 coverity#1399020 Dereference after null check Change-Id: Ic4a2eb0425cd48de85a40350c7368ade486842c2 diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 057d0a9..70a0f72 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -303,12 +303,12 @@ bool SwPaM::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::T } SwDocShell *const pDocShell = pNode->GetDoc()->GetDocShell(); - SwWrtShell *const pWrtShell = (pDocShell) ? pDocShell->GetWrtShell() : nullptr; - SwPostItMgr *const pPostItMgr = (pWrtShell) ? pWrtShell->GetPostItMgr() : nullptr; + SwWrtShell *const pWrtShell = pDocShell ? pDocShell->GetWrtShell() : nullptr; + SwPostItMgr *const pPostItMgr = pWrtShell ? pWrtShell->GetPostItMgr() : nullptr; // If there is an active text edit, then search there. bool bEndedTextEdit = false; - SdrView* pSdrView = pWrtShell->GetDrawView(); + SdrView* pSdrView = pWrtShell ? pWrtShell->GetDrawView() : nullptr; if (pSdrView) { // If the edited object is not anchored to this node, then ignore it. commit 359e68815db3354fff974993e2bf2449d9d722fc Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:18:44 2017 +0000 coverity#1399028 Unchecked dynamic_cast Change-Id: I17b566a13b0822e39cb5852150f407c9d9c84305 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index e5e4880..3380ad6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -113,7 +113,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo68787, "fdo68787.docx") DECLARE_OOXMLEXPORT_TEST(testTdf92470_footnoteRestart, "tdf92470_footnoteRestart.docx") { - SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT( pTextDoc ); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); CPPUNIT_ASSERT( pDoc ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote doesn't restart every Page", FTNNUM_PAGE, pDoc->GetFootnoteInfo().eNum ); commit 93454f5837fa045286232fff05065304fbfc7431 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:16:58 2017 +0000 coverity#1399032 Dereference null return value Change-Id: I1482b1ce9a9ec9556e076c8f74185a9ce29e8d08 diff --git a/svl/qa/unit/items/test_itempool.cxx b/svl/qa/unit/items/test_itempool.cxx index 38cbda3..0987a6b 100644 --- a/svl/qa/unit/items/test_itempool.cxx +++ b/svl/qa/unit/items/test_itempool.cxx @@ -135,7 +135,9 @@ void PoolItemTest::testItemSet() CPPUNIT_ASSERT_EQUAL((sal_uInt16)1, aIter.GetFirstWhich()); CPPUNIT_ASSERT_EQUAL((sal_uInt16)7, aIter.GetLastWhich()); - CPPUNIT_ASSERT_EQUAL((sal_uInt16)1, aIter.FirstItem()->Which()); + const SfxPoolItem *pFirstItem = aIter.FirstItem(); + CPPUNIT_ASSERT(pFirstItem); + CPPUNIT_ASSERT_EQUAL((sal_uInt16)1, pFirstItem->Which()); CPPUNIT_ASSERT_EQUAL((sal_uInt16)2, aIter.NextItem()->Which()); CPPUNIT_ASSERT_EQUAL((sal_uInt16)3, aIter.NextItem()->Which()); CPPUNIT_ASSERT_EQUAL((sal_uInt16)5, aIter.NextItem()->Which()); commit 1939a79c68cc91cd9ca56966e865715a0ea93f60 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:14:02 2017 +0000 coverity#1399429 Uninitialized scalar variable Change-Id: I7f10d609b9c031f4b51843bbd4ba945dc23ab169 diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx index 99143b0..ac3aa0d 100644 --- a/lotuswordpro/source/filter/lwpparastyle.cxx +++ b/lotuswordpro/source/filter/lwpparastyle.cxx @@ -346,7 +346,7 @@ void LwpParaStyle::ApplyParaBorder(XFParaStyle* pParaStyle, LwpParaBorderOverrid // apply 4 borders respectively LwpBorderStuff::BorderType pType[] = { LwpBorderStuff::LEFT, LwpBorderStuff::RIGHT, LwpBorderStuff::TOP, LwpBorderStuff::BOTTOM }; - float pMarginValue[4]; + float pMarginValue[4] = { 0.0, 0.0, 0.0, 0.0 }; for (sal_uInt8 nC = 0; nC < 4; nC++) { commit 1c64b1aa424e1d90ffdd3fc06fc9f70c03756abf Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:10:17 2017 +0000 coverity#1399436 Uninitialized scalar field Change-Id: Icd4bc58207cf61a03e167faf8289310e9d453c39 diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index c9e0387..0a5de7f 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -249,6 +249,7 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ) m_nCurTextWidth(0), m_nStartLine(USHRT_MAX), m_eSourceEncoding(osl_getThreadTextEncoding()), + m_bReadonly(false), m_bHighlighting(false), m_aSyntaxIdle("sw uibase SwSrcEditWindow Syntax") { commit 827dda8c67f24366cc1f499b4bbb73c2c8e6a4e2 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:08:54 2017 +0000 coverity#1399437 Uninitialized scalar field Change-Id: I0df77d7a986ca6485cfe18ee40249d6bb5621528 diff --git a/include/test/testinteractionhandler.hxx b/include/test/testinteractionhandler.hxx index 4e627b7..3e8c810 100644 --- a/include/test/testinteractionhandler.hxx +++ b/include/test/testinteractionhandler.hxx @@ -38,6 +38,7 @@ class TestInteractionHandler : public cppu::WeakImplHelper<css::lang::XServiceIn public: TestInteractionHandler(const OUString& sPassword) : msPassword(sPassword) + , mbPasswordRequested(false) {} virtual ~TestInteractionHandler() override commit bbe3053d4bf867f4f3a12f1a3efdb8df8520078d Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:07:35 2017 +0000 coverity#1399019 Division or modulo by zero Change-Id: I0f21612effa91a6c9e7e0a48c46dde88c4b34b94 diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index ce51ee4..3f20cd1 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -621,6 +621,9 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScRefCellValue& rCell, long nWidth return; long nMaxDigit = GetMaxDigitWidth(); + if (!nMaxDigit) + return; + sal_uInt16 nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit); { OUString sTempOut(aString); commit d420d9afb4527fd22dd0ae286b615beaddfc853f Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:06:04 2017 +0000 coverity#1399018 Logically dead code Change-Id: I2ef219b63250341851ecda7e1bb59bdc98406ff7 diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx index acec452..1615bd2 100644 --- a/sot/source/sdstor/stgole.cxx +++ b/sot/source/sdstor/stgole.cxx @@ -130,7 +130,7 @@ bool StgCompObjStream::Load() //all platforms and envs //https://bz.apache.org/ooo/attachment.cgi?id=68668 //for a good edge-case example - m_aUserName = nStrLen ? OUString( p.get(), nStrLen, RTL_TEXTENCODING_MS_1252 ) : OUString(); + m_aUserName = OUString(p.get(), nStrLen, RTL_TEXTENCODING_MS_1252); m_nCbFormat = ReadClipboardFormat( *this ); } else commit 7c3bd3cd8c9f3ee562ea158d7b380e5f7244fbb0 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:03:16 2017 +0000 coverity#1399017 Unchecked return value Change-Id: I67a8b8b5f63d3a44dc1df5c848da5797a6c20646 diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx index c69621b..8788afd 100644 --- a/vcl/source/outdev/polyline.cxx +++ b/vcl/source/outdev/polyline.cxx @@ -221,7 +221,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon, // to avoid optical gaps for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++) { - DrawPolyLineDirect( aAreaPolyPolygon.getB2DPolygon(a), 0.0, 0.0, basegfx::B2DLineJoin::NONE, css::drawing::LineCap_BUTT, 15.0 * F_PI180 /*default, not used*/, bTryAA); + (void)DrawPolyLineDirect( aAreaPolyPolygon.getB2DPolygon(a), 0.0, 0.0, basegfx::B2DLineJoin::NONE, css::drawing::LineCap_BUTT, 15.0 * F_PI180 /*default, not used*/, bTryAA); } } else commit bda662488c3aaf93002594adbb833cb7d3c3d83e Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 15:02:23 2017 +0000 coverity#1399015 Logically dead code Change-Id: I4d5e2c7d2bbd4eba3eeb790d51a4a93c7ef40577 diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 37324f4..4810f81 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -1037,7 +1037,7 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) pItem = GetItem( *rSet, SID_ATTR_TRANSFORM_HEIGHT ); sal_Int32 nHeight = std::max( pItem ? ( static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0, (sal_uInt32)1 ); m_pHeightMF->SetValue(m_pHeightMF->Normalize(nHeight), FUNIT_TWIP); - m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; + m_fWidthHeightRatio = double(nWidth) / double(nHeight); if(!m_bPositioningDisabled) { commit 56859198c2e49aa465c49bbfc5a18bfaef056202 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 14:59:57 2017 +0000 coverity#1399014 Unchecked return value Change-Id: I0423d9be8032cb7d405cba258c79e1c625f6eee8 diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 65eb83a..27a6c39 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -75,9 +75,9 @@ namespace TextFormatCollFunc { SwNumRule* pNumRule( nullptr ); - const SwNumRuleItem* pNumRuleItem( nullptr ); - rTextFormatColl.GetItemState( RES_PARATR_NUMRULE, false, reinterpret_cast<const SfxPoolItem**>(&pNumRuleItem) ); - if ( pNumRuleItem ) + const SwNumRuleItem* pNumRuleItem(nullptr); + (void)rTextFormatColl.GetItemState(RES_PARATR_NUMRULE, false, reinterpret_cast<const SfxPoolItem**>(&pNumRuleItem)); + if (pNumRuleItem) { const OUString sNumRuleName = pNumRuleItem->GetValue(); if ( !sNumRuleName.isEmpty() ) commit 8c6db946a5ffb2274eba3a2688f56ee7f2f60393 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 14:59:15 2017 +0000 coverity#1399013 Unchecked return value Change-Id: I5e9f32dfc97c0a06fcae399412354eda91bf3f4b diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index f0b91d8..65eb83a 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -54,11 +54,11 @@ namespace TextFormatCollFunc if ( !pTextFormatColl->StayAssignedToListLevelOfOutlineStyle() && pTextFormatColl->IsAssignedToListLevelOfOutlineStyle() ) { - if ( !pNewNumRuleItem ) + if (!pNewNumRuleItem) { - pTextFormatColl->GetItemState( RES_PARATR_NUMRULE, false, reinterpret_cast<const SfxPoolItem**>(&pNewNumRuleItem) ); + (void)pTextFormatColl->GetItemState(RES_PARATR_NUMRULE, false, reinterpret_cast<const SfxPoolItem**>(&pNewNumRuleItem)); } - if ( pNewNumRuleItem ) + if (pNewNumRuleItem) { OUString sNumRuleName = pNewNumRuleItem->GetValue(); if ( sNumRuleName.isEmpty() || commit 7667869db0e6c712fafd6aa98a2076dc4d3e19e2 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 14:56:46 2017 +0000 coverity#1361585 Unchecked dynamic_cast Change-Id: I664dc6d5c38bcc4fd75d436b67453983e4b57403 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 6ab2837..a576ce3 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3834,7 +3834,8 @@ void SwUiWriterTest::testTdf84695NormalChar() pWrtShell->SelectObj(Point(), 0, pObject); // Now pressing 'a' should add a character. - SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pXTextDocument); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'a', 0); uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY); commit 0c8799097ac338c7f443a981f5d384005c029782 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 14:56:08 2017 +0000 coverity#1361580 Unchecked dynamic_cast Change-Id: I02521b61d2832ba510aaf5170e67c1fd5f691334 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 3a4971f..6ab2837 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3810,7 +3810,8 @@ void SwUiWriterTest::testTdf84695() pWrtShell->SelectObj(Point(), 0, pObject); // Now Enter + a key should add some text. - SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pXTextDocument); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'a', 0); commit 95b42c9120ea68b136585e23a54a6558b9d2e50f Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 14:55:19 2017 +0000 coverity#1352253 Unchecked dynamic_cast Change-Id: I7634fd735f3bdb729c06bcbca05ae31c930db930 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index fd44880..3a4971f 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3372,6 +3372,7 @@ void SwUiWriterTest::testTdf89954() SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->EndPara(); SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pXTextDocument); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 't', 0); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'e', 0); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 's', 0); commit 3b6c21594ebf813c3448d1f9096e3766a2664268 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 21 14:53:50 2017 +0000 coverity#704840 Explicit null dereferenced Change-Id: Icf3dd9f6c34062b4bc43634b15d210ccf60f8ab9 diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index f6cb548..ac4ed1e 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -59,17 +59,14 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::drawing; UNO3_GETIMPLEMENTATION_IMPL( SvxDrawPage ); -SvxDrawPage::SvxDrawPage( SdrPage* pInPage ) throw() -: mrBHelper( getMutex() ) -, mpPage( pInPage ) -, mpModel( nullptr ) -{ - // register at broadcaster - if( mpPage ) - mpModel = mpPage->GetModel(); - // create (hidden) view - mpView = new SdrView( mpModel ); +SvxDrawPage::SvxDrawPage(SdrPage* pInPage) throw() + : mrBHelper(getMutex()) + , mpPage(pInPage) + , mpModel(mpPage->GetModel()) // register at broadcaster + , mpView(new SdrView(mpModel)) // create (hidden) view + +{ mpView->SetDesignMode(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits