New Defects reported by Coverity Scan for LibreOffice

scan-admin at coverity.com scan-admin at coverity.com
Sun May 22 05:21:11 UTC 2022


Hi,

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

14 new defect(s) introduced to LibreOffice found with Coverity Scan.
6 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 14 of 14 defect(s)


** CID 1504545:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1504545:  Null pointer dereferences  (FORWARD_NULL)
/sc/source/ui/unoobj/docuno.cxx: 1690 in ScModelObj::FillRenderMarkData(const com::sun::star::uno::Any &, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> &, ScMarkData &, ScPrintSelectionStatus &, rtl::OUString &, bool &) const()
1684         // restrict to selected sheets if a view is available
1685         uno::Reference<sheet::XSelectedSheetsSupplier> xSelectedSheets(xView, uno::UNO_QUERY);
1686         if (bSelectedSheetsOnly && xSelectedSheets.is())
1687         {
1688             const uno::Sequence<sal_Int32> aSelected = xSelectedSheets->getSelectedSheets();
1689             ScMarkData::MarkedTabsType aSelectedTabs;
>>>     CID 1504545:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "this->pDocShell" to "GetDocument", which dereferences it.
1690             SCTAB nMaxTab = pDocShell->GetDocument().GetTableCount() -1;
1691             for (const auto& rSelected : aSelected)
1692             {
1693                 SCTAB nSelected = static_cast<SCTAB>(rSelected);
1694                 if (ValidTab(nSelected, nMaxTab))
1695                     aSelectedTabs.insert(nSelected);

** CID 1504544:  Uninitialized members  (UNINIT_CTOR)
/comphelper/source/streaming/memorystream.cxx: 93 in comphelper::<unnamed>::UNOMemoryStream::NoInitInt8::NoInitInt8()()


________________________________________________________________________________________________________
*** CID 1504544:  Uninitialized members  (UNINIT_CTOR)
/comphelper/source/streaming/memorystream.cxx: 93 in comphelper::<unnamed>::UNOMemoryStream::NoInitInt8::NoInitInt8()()
87         {
88             sal_Int8 value;
89             NoInitInt8() noexcept {
90                 // do nothing
91                 static_assert(sizeof(NoInitInt8) == sizeof(sal_Int8), "invalid size");
92                 static_assert(alignof(NoInitInt8) == alignof(sal_Int8), "invalid alignment");
>>>     CID 1504544:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "value" is not initialized in this constructor nor in any functions that it calls.
93             }
94         };
95     
96         std::vector< NoInitInt8 > maData;
97         sal_Int32 mnCursor;
98     };

** CID 1504543:  Uninitialized members  (UNINIT_CTOR)
/binaryurp/source/bridge.cxx: 205 in binaryurp::Bridge::Bridge(const rtl::Reference<binaryurp::BridgeFactory> &, rtl::OUString, const com::sun::star::uno::Reference<com::sun::star::connection::XConnection> &, com::sun::star::uno::Reference<com::sun::star::bridge::XInstanceProvider>)()


________________________________________________________________________________________________________
*** CID 1504543:  Uninitialized members  (UNINIT_CTOR)
/binaryurp/source/bridge.cxx: 205 in binaryurp::Bridge::Bridge(const rtl::Reference<binaryurp::BridgeFactory> &, rtl::OUString, const com::sun::star::uno::Reference<com::sun::star::connection::XConnection> &, com::sun::star::uno::Reference<com::sun::star::bridge::XInstanceProvider>)()
199             throw css::uno::RuntimeException("URP: no binary UNO environment");
200         }
201         if (!(cppToBinaryMapping_.is() && binaryToCppMapping_.is())) {
202             throw css::uno::RuntimeException("URP: no C++ UNO mapping");
203         }
204         passive_.set();
>>>     CID 1504543:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "random_" is not initialized in this constructor nor in any functions that it calls.
205     }
206     
207     void Bridge::start() {
208         rtl::Reference r(new Reader(this));
209         rtl::Reference w(new Writer(this));
210         {

** CID 1504542:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/styleuno.cxx: 1750 in ScStyleObj::setPropertyValue_Impl(std::basic_string_view<char16_t, std::char_traits<char16_t>>, const SfxItemPropertyMapEntry *, const com::sun::star::uno::Any *)()


________________________________________________________________________________________________________
*** CID 1504542:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/styleuno.cxx: 1750 in ScStyleObj::setPropertyValue_Impl(std::basic_string_view<char16_t, std::char_traits<char16_t>>, const SfxItemPropertyMapEntry *, const com::sun::star::uno::Any *)()
1744     
1745         ScDocument& rDoc = pDocShell->GetDocument();
1746         if ( eFamily == SfxStyleFamily::Para )
1747         {
1748             // If we are loading, we can delay line height calculation, because we are going to re-calc all of those
1749             // after load.
>>>     CID 1504542:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "this->pDocShell" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1750             if (pDocShell && !pDocShell->IsLoading())
1751             {
1752                 // update line height
1753                 ScopedVclPtrInstance< VirtualDevice > pVDev;
1754                 Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
1755                 double nPPTX = aLogic.X() / 1000.0;

** CID 1504541:  Uninitialized members  (UNINIT_CTOR)
/include/vcl/pdfwriter.hxx: 402 in vcl::PDFWriter::EditWidget::EditWidget()()


________________________________________________________________________________________________________
*** CID 1504541:  Uninitialized members  (UNINIT_CTOR)
/include/vcl/pdfwriter.hxx: 402 in vcl::PDFWriter::EditWidget::EditWidget()()
396                       MultiLine( false ),
397                       Password( false ),
398                       FileSelect( false ),
399                       MaxLen( 0 ),
400                       Format( FormatType::Text ),
401                       PrependCurrencySymbol( false )
>>>     CID 1504541:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "DecimalAccuracy" is not initialized in this constructor nor in any functions that it calls.
402             {}
403     
404             virtual std::shared_ptr<AnyWidget> Clone() const override
405             {
406                 return std::make_shared<EditWidget>( *this );
407             }

** CID 1504540:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/docuno.cxx: 4128 in ScTableColumnsObj::hasByName(const rtl::OUString &)()


________________________________________________________________________________________________________
*** CID 1504540:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/docuno.cxx: 4128 in ScTableColumnsObj::hasByName(const rtl::OUString &)()
4122     
4123     sal_Bool SAL_CALL ScTableColumnsObj::hasByName( const OUString& aName )
4124     {
4125         SolarMutexGuard aGuard;
4126         SCCOL nCol = 0;
4127         if ( ::AlphaToCol( pDocShell->GetDocument(), nCol, aName) )
>>>     CID 1504540:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "this->pDocShell" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
4128             if ( pDocShell && nCol >= nStartCol && nCol <= nEndCol )
4129                 return true;
4130     
4131         return false;       // not found
4132     }
4133     

** CID 1504539:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/dapiuno.cxx: 1263 in ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell *)()


________________________________________________________________________________________________________
*** CID 1504539:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/dapiuno.cxx: 1263 in ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell *)()
1257         for (const uno::Reference<util::XModifyListener> & xModifyListener : aModifyListeners)
1258             rDoc.AddUnoListenerCall( xModifyListener, aEvent );
1259     }
1260     
1261     ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
1262         ScDataPilotDescriptorBase( pDocSh ),
>>>     CID 1504539:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "pDocSh" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1263         mpDPObject(new ScDPObject(pDocSh ? &pDocSh->GetDocument() : nullptr) )
1264     {
1265         ScDPSaveData aSaveData;
1266         // set defaults like in ScPivotParam constructor
1267         aSaveData.SetColumnGrand( true );
1268         aSaveData.SetRowGrand( true );

** CID 1504538:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1504538:  Null pointer dereferences  (FORWARD_NULL)
/sc/source/ui/miscdlgs/redcom.cxx: 153 in ScRedComDialog::PrevHdl(AbstractSvxPostItDialog &)()
147     IMPL_LINK(ScRedComDialog, PrevHdl, AbstractSvxPostItDialog&, rDlgP, void )
148     {
149         if (pDocShell!=nullptr && rDlgP.GetNote() != aComment )
150             pDocShell->SetChangeComment( pChangeAction, rDlgP.GetNote());
151     
152         ReInit(FindPrev(pChangeAction));
>>>     CID 1504538:  Null pointer dereferences  (FORWARD_NULL)
>>>     "SelectCell" dereferences null "this->pDocShell".
153         SelectCell();
154     }
155     
156     IMPL_LINK(ScRedComDialog, NextHdl, AbstractSvxPostItDialog&, rDlgP, void )
157     {
158         if ( pDocShell!=nullptr && rDlgP.GetNote() != aComment )

** CID 1504537:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1504537:  Null pointer dereferences  (FORWARD_NULL)
/sc/source/ui/view/viewdata.cxx: 785 in ScViewData::ScViewData(ScDocument *, ScDocShell *, ScTabViewShell *)()
779     // Either pDoc or pDocSh must be valid
780     ScViewData::ScViewData(ScDocument* pDoc, ScDocShell* pDocSh, ScTabViewShell* pViewSh) :
781             nPPTX(0.0),
782             nPPTY(0.0),
783             maMarkData  (pDocSh ? pDocSh->GetDocument().GetSheetLimits() : pDoc->GetSheetLimits()),
784             pDocShell   ( pDocSh ),
>>>     CID 1504537:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "pDocSh" to "GetDocument", which dereferences it.
785             mrDoc       (pDoc ? *pDoc : pDocSh->GetDocument()),
786             pView       ( pViewSh ),
787             maOptions   (pDocSh ? pDocSh->GetDocument().GetViewOptions() : DefaultOptions()),
788             pSpellingView ( nullptr ),
789             aLogicMode  ( MapUnit::Map100thMM ),
790             eDefZoomType( SvxZoomType::PERCENT ),

** CID 1504536:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1504536:  Null pointer dereferences  (FORWARD_NULL)
/sc/source/ui/miscdlgs/redcom.cxx: 162 in ScRedComDialog::NextHdl(AbstractSvxPostItDialog &)()
156     IMPL_LINK(ScRedComDialog, NextHdl, AbstractSvxPostItDialog&, rDlgP, void )
157     {
158         if ( pDocShell!=nullptr && rDlgP.GetNote() != aComment )
159             pDocShell->SetChangeComment( pChangeAction, rDlgP.GetNote());
160     
161         ReInit(FindNext(pChangeAction));
>>>     CID 1504536:  Null pointer dereferences  (FORWARD_NULL)
>>>     "SelectCell" dereferences null "this->pDocShell".
162         SelectCell();
163     }
164     

** CID 1504535:  Uninitialized members  (UNINIT_CTOR)
/vcl/inc/pdf/pdfwriter_impl.hxx: 495 in vcl::pdf::PDFWidget::PDFWidget()()


________________________________________________________________________________________________________
*** CID 1504535:  Uninitialized members  (UNINIT_CTOR)
/vcl/inc/pdf/pdfwriter_impl.hxx: 495 in vcl::pdf::PDFWidget::PDFWidget()()
489                   m_nTabOrder( 0 ),
490                   m_nRadioGroup( -1 ),
491                   m_nMaxLen( 0 ),
492                   m_bSubmit( false ),
493                   m_bSubmitGet( false ),
494                   m_nDest( -1 )
>>>     CID 1504535:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "m_bPrependCurrencySymbol" is not initialized in this constructor nor in any functions that it calls.
495         {}
496     };
497     
498     struct PDFStructureAttribute
499     {
500         PDFWriter::StructAttributeValue     eValue;

** CID 1504534:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/docuno.cxx: 4019 in ScTableColumnsObj::GetObjectByName_Impl(const rtl::OUString &) const()


________________________________________________________________________________________________________
*** CID 1504534:  Null pointer dereferences  (REVERSE_INULL)
/sc/source/ui/unoobj/docuno.cxx: 4019 in ScTableColumnsObj::GetObjectByName_Impl(const rtl::OUString &) const()
4013     }
4014     
4015     rtl::Reference<ScTableColumnObj> ScTableColumnsObj::GetObjectByName_Impl(const OUString& aName) const
4016     {
4017         SCCOL nCol = 0;
4018         if ( ::AlphaToCol( pDocShell->GetDocument(), nCol, aName) )
>>>     CID 1504534:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "this->pDocShell" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
4019             if ( pDocShell && nCol >= nStartCol && nCol <= nEndCol )
4020                 return new ScTableColumnObj( pDocShell, nCol, nTab );
4021     
4022         return nullptr;
4023     }
4024     

** CID 1504533:  Error handling issues  (UNCAUGHT_EXCEPT)
/sc/source/core/data/column3.cxx: 129 in <unnamed>::CellInterpreterBase::~CellInterpreterBase()()


________________________________________________________________________________________________________
*** CID 1504533:  Error handling issues  (UNCAUGHT_EXCEPT)
/sc/source/core/data/column3.cxx: 129 in <unnamed>::CellInterpreterBase::~CellInterpreterBase()()
123                 return;
124             }
125             firstCell = p;
126             lastPos = p->aPos;
127     
128         }
>>>     CID 1504533:  Error handling issues  (UNCAUGHT_EXCEPT)
>>>     An exception of type "com::sun::star::uno::RuntimeException" is thrown but the throw list "noexcept" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate().
129         ~CellInterpreterBase()
130         {
131             flushPending();
132         }
133     private:
134         void flushPending()

** CID 1504532:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1504532:  Null pointer dereferences  (FORWARD_NULL)
/sc/source/ui/unoobj/chartuno.cxx: 120 in ScChartsObj::GetObjectByIndex_Impl(long) const()
114                     }
115                 }
116             }
117         }
118     
119         if (!aName.isEmpty())
>>>     CID 1504532:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "this->pDocShell" to "ScChartObj", which dereferences it.
120             return new ScChartObj( pDocShell, nTab, aName );
121         return nullptr;
122     }
123     
124     rtl::Reference<ScChartObj> ScChartsObj::GetObjectByName_Impl(const OUString& aName) const
125     {


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3DU3u1_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJiBi5rFyQS9TXo8Cvszxx-2BuhoYNPReDO3bi-2BSWdgYEmCbJJE0M5ojGY4VW7YuSlwYtsGenyPcUscBJSyvSG6TLZhaXWWpm0GInapqshp9CBewUABq-2BnnpWnLtiH-2BBflg3NK6ZTN-2B19pxoHzGj-2BYNyZ44PB0Pq2Oxd3Et5IvfVS63Y-3D



More information about the LibreOffice mailing list