New Defects reported by Coverity Scan for LibreOffice

scan-admin at coverity.com scan-admin at coverity.com
Sun Jun 16 05:56:52 UTC 2024


Hi,

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

4 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 4 of 4 defect(s)


** CID 1603806:  API usage errors  (INVALIDATE_ITERATOR)
/sw/source/core/unocore/unofield.cxx: 2954 in SwXTextFieldTypes::getByUniqueID(const rtl::OUString &)()


________________________________________________________________________________________________________
*** CID 1603806:  API usage errors  (INVALIDATE_ITERATOR)
/sw/source/core/unocore/unofield.cxx: 2954 in SwXTextFieldTypes::getByUniqueID(const rtl::OUString &)()
2948     
2949         const SwFieldTypes* pFieldTypes = rDoc.getIDocumentFieldsAccess().GetFieldTypes();
2950         auto fieldTypeIt = std::find_if(pFieldTypes->begin(), pFieldTypes->end(),
2951                                [](const std::unique_ptr<SwFieldType>& pType) {
2952                                    return pType->Which() == SwFieldIds::Postit;
2953                                 });
>>>     CID 1603806:  API usage errors  (INVALIDATE_ITERATOR)
>>>     Dereferencing iterator "fieldTypeIt" though it is already past the end of its container.
2954         const SwFieldType & rCurType = **fieldTypeIt;
2955         std::vector<SwFormatField*> vFormatFields;
2956         rCurType.GatherFields(vFormatFields);
2957         for (const SwFormatField* pFormatField : vFormatFields)
2958         {
2959             const SwPostItField* pField = static_cast<const SwPostItField*>(pFormatField->GetField());

** CID 1603805:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sc/inc/document.hxx: 1987 in ScDocument::SetGoalSeekSettings(ScGoalSeekSettings)()


________________________________________________________________________________________________________
*** CID 1603805:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sc/inc/document.hxx: 1987 in ScDocument::SetGoalSeekSettings(ScGoalSeekSettings)()
1981     
1982         // Goal Seek solver
1983         bool               Solver( SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
1984                                    SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1985                                    const OUString& sValStr, double& nX, bool setNA = true);
1986         ScGoalSeekSettings GetGoalSeekSettings() { return maGoalSeekSettings; }
>>>     CID 1603805:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "aNewSettings" is copied in a call to copy assignment "operator =", when it could be moved instead.
1987         void               SetGoalSeekSettings(ScGoalSeekSettings aNewSettings) { maGoalSeekSettings = aNewSettings; }
1988     
1989         SC_DLLPUBLIC void           ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
1990                                                            ScEditDataArray* pDataArray = nullptr, bool* pIsChanged = nullptr );
1991         SC_DLLPUBLIC void           DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
1992         void                        DeleteSelectionTab( SCTAB nTab, InsertDeleteFlags nDelFlag, const ScMarkData& rMark );

** CID 1603804:  Error handling issues  (CHECKED_RETURN)
/linguistic/source/dicimp.cxx: 133 in ReadDicVersion(SvStream &, o3tl::strong_int<unsigned short, LanguageTypeTag> &, bool &, rtl::OUString &)()


________________________________________________________________________________________________________
*** CID 1603804:  Error handling issues  (CHECKED_RETURN)
/linguistic/source/dicimp.cxx: 133 in ReadDicVersion(SvStream &, o3tl::strong_int<unsigned short, LanguageTypeTag> &, bool &, rtl::OUString &)()
127             bool bSuccess;
128             OStringBuffer aLine;
129     
130             nDicVersion = DIC_VERSION_7;
131     
132             // 1st skip magic / header line
>>>     CID 1603804:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "ReadLine" without checking return value (as is done elsewhere 13 out of 16 times).
133             rStream.ReadLine(aLine);
134     
135             // 2nd line: language all | en-US | pt-BR ...
136             while ((bSuccess = rStream.ReadLine(aLine)))
137             {
138                 OString aTagValue;

** CID 1603803:  Error handling issues  (CHECKED_RETURN)
/sc/source/ui/docshell/impex.cxx: 2069 in ScImportExport::Sylk2Doc(SvStream &)()


________________________________________________________________________________________________________
*** CID 1603803:  Error handling issues  (CHECKED_RETURN)
/sc/source/ui/docshell/impex.cxx: 2069 in ScImportExport::Sylk2Doc(SvStream &)()
2063             SCCOL nRefCol = nCol;
2064             SCROW nRefRow = nRow;
2065             rStrm.Seek( nOldPos );
2066             for( ;; )
2067             {
2068                 //! allow unicode
>>>     CID 1603803:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "ReadLine" without checking return value (as is done elsewhere 13 out of 16 times).
2069                 rStrm.ReadLine( aByteLine );
2070                 aLine = OStringToOUString(aByteLine, rStrm.GetStreamCharSet());
2071                 if( rStrm.eof() )
2072                     break;
2073                 bool bInvalidCol = false;
2074                 bool bInvalidRow = false;


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=u001.AxU2LYlgjL6eX23u9ErQy-2BKADyCpvUKOL6EWmZljiu6VvXBlQRUbS683tC8265rGNPXqJ1ffcoLZCnTuJFQbNcTEkb4XaEQkzovKhJ5DB3c-3D8Mjn_A9M4dSy7guk8NP6DcfgslOyvJRzavztVIKj6nRqYjYpWom7SJFyX0y710bz0kUGtwMm5rZaMO94sKfUcL3TmwHU2-2Fj1i1BYkdxB2Y4V1fTMaG-2FiPoRcFz3GtZi6wOSYiGvABF4pu3hWJX9fGfVtfxd79dYYbTPWxBy9xUz8BLIRQjFTvKQ9DRBeQn97VmHrxgJy2vPwedBxqVqWMr08KvvXTcClpIIo9yByP2O9juWw-3D



More information about the LibreOffice mailing list