New Defects reported by Coverity Scan for LibreOffice

scan-admin at coverity.com scan-admin at coverity.com
Wed Jul 5 09:00:50 UTC 2017


Hi,

Please find the latest report on new defect(s) introduced to LibreOffice found with Coverity Scan.

11 new defect(s) introduced to LibreOffice found with Coverity Scan.
1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 11 of 11 defect(s)


** CID 1414486:    (FORWARD_NULL)
/sd/qa/unit/tiledrendering/tiledrendering.cxx: 1804 in SdTiledRenderingTest::testDisableUndoRepair()()
/sd/qa/unit/tiledrendering/tiledrendering.cxx: 1822 in SdTiledRenderingTest::testDisableUndoRepair()()


________________________________________________________________________________________________________
*** CID 1414486:    (FORWARD_NULL)
/sd/qa/unit/tiledrendering/tiledrendering.cxx: 1804 in SdTiledRenderingTest::testDisableUndoRepair()()
1798             std::unique_ptr<SfxPoolItem> pItem1;
1799             std::unique_ptr<SfxPoolItem> pItem2;
1800             pView1->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem1);
1801             pView2->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem2);
1802             CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item* >(pItem1.get()));
1803             CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(pItem2.get()));
>>>     CID 1414486:    (FORWARD_NULL)
>>>     Dynamic cast to pointer "dynamic_cast <SfxUInt32Item const *>(pItem2.get())" can return "NULL".
1804             CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(pItem2.get())->GetValue());
1805         }
1806     
1807         // Insert a character in the second view.
1808         SfxLokHelper::setView(nView2);
1809         pXImpressDocument->setPart(1);
/sd/qa/unit/tiledrendering/tiledrendering.cxx: 1822 in SdTiledRenderingTest::testDisableUndoRepair()()
1816             std::unique_ptr<SfxPoolItem> pItem1;
1817             std::unique_ptr<SfxPoolItem> pItem2;
1818             pView1->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem1);
1819             pView2->GetViewFrame()->GetBindings().QueryState(SID_UNDO, pItem2);
1820             CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item* >(pItem2.get()));
1821             CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(pItem1.get()));
>>>     CID 1414486:    (FORWARD_NULL)
>>>     Dynamic cast to pointer "dynamic_cast <SfxUInt32Item const *>(pItem1.get())" can return "NULL".
1822             CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(pItem1.get())->GetValue());
1823         }
1824     }
1825     
1826     CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
1827     
1828     CPPUNIT_PLUGIN_IMPLEMENT();
1829     

** CID 1414485:  Uninitialized members  (UNINIT_CTOR)
/sw/inc/bparr.hxx: 64 in BlockInfo::BlockInfo(BigPtrArray *)()


________________________________________________________________________________________________________
*** CID 1414485:  Uninitialized members  (UNINIT_CTOR)
/sw/inc/bparr.hxx: 64 in BlockInfo::BlockInfo(BigPtrArray *)()
58                      pBigArr;              ///< in this array the block is located
59         std::array<BigPtrEntry*, MAXENTRY>
60                      mvData;               ///< data block
61         sal_uLong    nStart, nEnd;         ///< start- and end index
62         sal_uInt16   nElem;                ///< number of elements
63     
>>>     CID 1414485:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "nElem" is not initialized in this constructor nor in any functions that it calls.
64         BlockInfo(BigPtrArray* b) : pBigArr(b) {}
65     };
66     
67     class SW_DLLPUBLIC BigPtrArray
68     {
69     protected:

** CID 1414484:  Integer handling issues  (DIVIDE_BY_ZERO)
/vcl/source/filter/graphicfilter2.cxx: 590 in GraphicDescriptor::ImpDetectPNG(SvStream &, bool)()


________________________________________________________________________________________________________
*** CID 1414484:  Integer handling issues  (DIVIDE_BY_ZERO)
/vcl/source/filter/graphicfilter2.cxx: 590 in GraphicDescriptor::ImpDetectPNG(SvStream &, bool)()
584                         cByte = 0;
585                         rStm.ReadUChar( cByte );
586     
587                         if ( cByte )
588                         {
589                             if ( nXRes )
>>>     CID 1414484:  Integer handling issues  (DIVIDE_BY_ZERO)
>>>     In expression "this->aPixSize.Width() * 100000L / nTemp32", division by expression "nTemp32" which may be zero has undefined behavior.
590                                 aLogSize.Width() = ( aPixSize.Width() * 100000 ) /
591                                                    nTemp32;
592     
593                             if ( nYRes )
594                                 aLogSize.Height() = ( aPixSize.Height() * 100000 ) /
595                                                     nTemp32;

** CID 1414483:  Null pointer dereferences  (FORWARD_NULL)
/sw/source/uibase/shells/grfsh.cxx: 136 in SwGrfShell::Execute(SfxRequest &)()


________________________________________________________________________________________________________
*** CID 1414483:  Null pointer dereferences  (FORWARD_NULL)
/sw/source/uibase/shells/grfsh.cxx: 136 in SwGrfShell::Execute(SfxRequest &)()
130             }
131     
132             case SID_SAVE_GRAPHIC:
133             {
134                 GraphicAttr aGraphicAttr;
135                 const GraphicObject* pGraphicObj = rSh.GetGraphicObj();
>>>     CID 1414483:  Null pointer dereferences  (FORWARD_NULL)
>>>     Comparing "pGraphicObj" to null implies that "pGraphicObj" might be null.
136                 if (pGraphicObj)
137                 {
138                     rSh.GetGraphicAttr(aGraphicAttr);
139                 }
140     
141                 short nState = RET_CANCEL;

** CID 1414482:  Null pointer dereferences  (FORWARD_NULL)
/sd/qa/unit/tiledrendering/tiledrendering.cxx: 1200 in SdTiledRenderingTest::testUndoLimiting()()


________________________________________________________________________________________________________
*** CID 1414482:  Null pointer dereferences  (FORWARD_NULL)
/sd/qa/unit/tiledrendering/tiledrendering.cxx: 1200 in SdTiledRenderingTest::testUndoLimiting()()
1194         // Now check view2 cannot undo actions.
1195         {
1196             SfxRequest aReq2(SID_UNDO, SfxCallMode::SLOT, pXImpressDocument->GetDocShell()->GetDoc()->GetPool());
1197             aReq2.AppendItem(SfxUInt16Item(SID_UNDO, 1));
1198             pViewShell2->ExecuteSlot(aReq2);
1199             CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aReq2.GetReturnValue()));
>>>     CID 1414482:  Null pointer dereferences  (FORWARD_NULL)
>>>     Dynamic cast to pointer "dynamic_cast <SfxUInt32Item const *>(aReq2.GetReturnValue())" can return "NULL".
1200             CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(aReq2.GetReturnValue())->GetValue());
1201         }
1202     
1203         // Now check view1 can undo action
1204         {
1205             SfxRequest aReq1(SID_UNDO, SfxCallMode::SLOT, pXImpressDocument->GetDocShell()->GetDoc()->GetPool());

** CID 1414481:  Uninitialized members  (UNINIT_CTOR)
/sc/source/ui/styleui/styledlg.cxx: 118 in ScStyleDlg::ScStyleDlg(vcl::Window *, SfxStyleSheetBase &, unsigned short)()


________________________________________________________________________________________________________
*** CID 1414481:  Uninitialized members  (UNINIT_CTOR)
/sc/source/ui/styleui/styledlg.cxx: 118 in ScStyleDlg::ScStyleDlg(vcl::Window *, SfxStyleSheetBase &, unsigned short)()
112                 }
113                 break;
114     
115             default:
116                 OSL_FAIL( "Family not supported" );
117         }
>>>     CID 1414481:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "m_nFooterId" is not initialized in this constructor nor in any functions that it calls.
118     }
119     
120     void ScStyleDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
121     {
122         if ( nDlgRsc == RID_SCDLG_STYLES_PAR )
123         {

** CID 1414480:    (FORWARD_NULL)
/sc/qa/unit/tiledrendering/tiledrendering.cxx: 1392 in <unnamed>::ScTiledRenderingTest::testDisableUndoRepair()()
/sc/qa/unit/tiledrendering/tiledrendering.cxx: 1411 in <unnamed>::ScTiledRenderingTest::testDisableUndoRepair()()


________________________________________________________________________________________________________
*** CID 1414480:    (FORWARD_NULL)
/sc/qa/unit/tiledrendering/tiledrendering.cxx: 1392 in <unnamed>::ScTiledRenderingTest::testDisableUndoRepair()()
1386             pView1->GetSlotState(SID_UNDO, nullptr, &aSet1);
1387             pView2->GetSlotState(SID_UNDO, nullptr, &aSet2);
1388             CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet1.GetItemState(SID_UNDO));
1389             CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet1.GetItem(SID_UNDO)));
1390             CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet2.GetItemState(SID_UNDO));
1391             CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aSet2.GetItem(SID_UNDO)));
>>>     CID 1414480:    (FORWARD_NULL)
>>>     Dynamic cast to pointer "dynamic_cast <SfxUInt32Item const *>(aSet2.GetItem(5701, true))" can return "NULL".
1392             CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item* >(aSet2.GetItem(SID_UNDO))->GetValue());
1393         }
1394     
1395         // text edit a cell in view #2
1396         SfxLokHelper::setView(nView2);
1397         pModelObj->setPart(1);
/sc/qa/unit/tiledrendering/tiledrendering.cxx: 1411 in <unnamed>::ScTiledRenderingTest::testDisableUndoRepair()()
1405             SfxItemSet aSet1(pView1->GetPool(), svl::Items<SID_UNDO, SID_UNDO>{});
1406             SfxItemSet aSet2(pView2->GetPool(), svl::Items<SID_UNDO, SID_UNDO>{});
1407             pView1->GetSlotState(SID_UNDO, nullptr, &aSet1);
1408             pView2->GetSlotState(SID_UNDO, nullptr, &aSet2);
1409             CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet1.GetItemState(SID_UNDO));
1410             CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aSet1.GetItem(SID_UNDO)));
>>>     CID 1414480:    (FORWARD_NULL)
>>>     Dynamic cast to pointer "dynamic_cast <SfxUInt32Item const *>(aSet1.GetItem(5701, true))" can return "NULL".
1411             CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item* >(aSet1.GetItem(SID_UNDO))->GetValue());
1412             CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet2.GetItemState(SID_UNDO));
1413             CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet2.GetItem(SID_UNDO)));
1414         }
1415     }
1416     

** CID 1414479:  Null pointer dereferences  (FORWARD_NULL)
/sw/qa/extras/tiledrendering/tiledrendering.cxx: 1744 in <unnamed>::checkUndoRepairStates(SwXTextDocument *, SwView *, SwView *)()


________________________________________________________________________________________________________
*** CID 1414479:  Null pointer dereferences  (FORWARD_NULL)
/sw/qa/extras/tiledrendering/tiledrendering.cxx: 1744 in <unnamed>::checkUndoRepairStates(SwXTextDocument *, SwView *, SwView *)()
1738         const SfxUInt32Item *pUnsetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet1.GetItem(SID_UNDO));
1739         CPPUNIT_ASSERT(!pUnsetItem);
1740         // second view, undo conflict
1741         pView2->GetState(aItemSet2);
1742         CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet2.GetItemState(SID_UNDO));
1743         CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO)));
>>>     CID 1414479:  Null pointer dereferences  (FORWARD_NULL)
>>>     Dynamic cast to pointer "dynamic_cast <SfxUInt32Item const *>(aItemSet2.GetItem(5701, true))" can return "NULL".
1744         CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))->GetValue());
1745     };
1746     
1747     }
1748     
1749     void SwTiledRenderingTest::testDisableUndoRepair()

** CID 1242900:  Code maintainability issues  (UNUSED_VALUE)
/cui/source/options/optjava.cxx: 599 in SvxJavaOptionsPage::FillItemSet(SfxItemSet *)()


________________________________________________________________________________________________________
*** CID 1242900:  Code maintainability issues  (UNUSED_VALUE)
/cui/source/options/optjava.cxx: 599 in SvxJavaOptionsPage::FillItemSet(SfxItemSet *)()
593         }
594     
595     #if HAVE_FEATURE_JAVA
596         javaFrameworkError eErr = JFW_E_NONE;
597         if ( m_pParamDlg )
598         {
>>>     CID 1242900:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "jfw_setVMParameters(std::vector<rtl::OUString, std::allocator<rtl::OUString> >(this->m_pParamDlg->GetParameters()))" to "eErr" here, but that stored value is overwritten before it can be used.
599             eErr = jfw_setVMParameters( m_pParamDlg->GetParameters() );
600             SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters");
601             bModified = true;
602         }
603     
604         if ( m_pPathDlg )

** CID 1242871:  Code maintainability issues  (UNUSED_VALUE)
/cui/source/options/optjava.cxx: 640 in SvxJavaOptionsPage::FillItemSet(SfxItemSet *)()


________________________________________________________________________________________________________
*** CID 1242871:  Code maintainability issues  (UNUSED_VALUE)
/cui/source/options/optjava.cxx: 640 in SvxJavaOptionsPage::FillItemSet(SfxItemSet *)()
634                         {
635                             svtools::executeRestartDialog(
636                                 comphelper::getProcessComponentContext(), this,
637                                 svtools::RESTART_REASON_JAVA);
638                         }
639     
>>>     CID 1242871:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "jfw_setSelectedJRE(pInfo)" to "eErr" here, but that stored value is overwritten before it can be used.
640                         eErr = jfw_setSelectedJRE( pInfo );
641                         SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setSelectedJRE");
642                         bModified = true;
643                     }
644                 }
645                 break;

** CID 1242834:  Code maintainability issues  (UNUSED_VALUE)
/cui/source/options/optjava.cxx: 609 in SvxJavaOptionsPage::FillItemSet(SfxItemSet *)()


________________________________________________________________________________________________________
*** CID 1242834:  Code maintainability issues  (UNUSED_VALUE)
/cui/source/options/optjava.cxx: 609 in SvxJavaOptionsPage::FillItemSet(SfxItemSet *)()
603     
604         if ( m_pPathDlg )
605         {
606             OUString sPath( m_pPathDlg->GetClassPath() );
607             if ( m_pPathDlg->GetOldPath() != sPath )
608             {
>>>     CID 1242834:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "jfw_setUserClassPath(sPath)" to "eErr" here, but that stored value is overwritten before it can be used.
609                 eErr = jfw_setUserClassPath( sPath );
610                 SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath");
611                 bModified = true;
612             }
613         }
614     


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZBnDJeNb0HijxaS4JNJPxk3kpyAm2AYqo71yXmnOxB72ibeUH-2F-2F1Lhi9AZq3dRu-2F4-3D_g-2BrHdvqzaBa155F-2F8AmPhpJzY63UzWDisJV95WUBpGhqFw1ICExHG8aMaV2EoFpyS09JKh0aLnsdLCJ7xqWI0YiznEnsDMGgIz1mnn5eJuDnJVTh2s19l5kbIXrXN8IZVDk-2BnjpVoFVapOp35S22nyA96wLFX4ZvkCEPFfGr4E-2BdcunQIUwETJUjRYIsLT6w2G5txzsfueyeC-2BoAwHVg4KhGVStIqNnMbx3GoWCghSc-3D

To manage Coverity Scan email notifications for "libreoffice at lists.freedesktop.org", click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4k1FZJSDV-2FTHi5VQof9xGafB4oBwGYxuHHknceo2QLpCrZ44Ciy7AqBR2QyX6OCB5N5X-2B1MAElavPQhH6nLwozJzqOkt2k8uOkYf2ZoppNa9QVe0T3fEZVQ7Kky1tOkLz_g-2BrHdvqzaBa155F-2F8AmPhpJzY63UzWDisJV95WUBpGhqFw1ICExHG8aMaV2EoFpyS09JKh0aLnsdLCJ7xqWI0bu1-2Fc5ynVgAhKRId1Cwb8Oh7I-2FqpI8T5Ju7bzYPJ-2BwbVu7FgOOttP7eFSZtVPqMvM-2FHrkD6MQysJhRC5DSOpOPV7hRiwrX4-2BUwl2AzL1XEiDXWcn2ZoDQGm0-2B3VVnzL5bjOL-2BkDsoXHMHu8r1laf5M-3D



More information about the LibreOffice mailing list