New Defects reported by Coverity Scan for LibreOffice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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

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


** CID 1473323:  Incorrect expression  (IDENTICAL_BRANCHES)
/sd/source/ui/app/sdpopup.cxx: 122 in SdFieldPopup::Fill(o3tl::strong_int<unsigned short, LanguageTypeTag>)()


________________________________________________________________________________________________________
*** CID 1473323:  Incorrect expression  (IDENTICAL_BRANCHES)
/sd/source/ui/app/sdpopup.cxx: 122 in SdFieldPopup::Fill(o3tl::strong_int<unsigned short, LanguageTypeTag>)()
116             m_xPopup->set_active(OString::number(static_cast<sal_uInt16>( pTimeField->GetFormat() ) + 1), true); // - 2 + 3 !
117         }
118         else if( auto pFileField = dynamic_cast< const SvxExtFileField *>( m_pField ) )
119         {
120             //SvxExtFileField aFileField( *pFileField );
121     
>>>     CID 1473323:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "pFileField->GetType() == SvxFileType::Fix" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
122             if( pFileField->GetType() == SvxFileType::Fix )
123                 m_xPopup->set_active("1", true);
124             else
125                 m_xPopup->set_active("1", true);
126     
127             m_xPopup->append_radio(OUString::number(nID++), SdResId(STR_FILEFORMAT_NAME_EXT));

** CID 1473322:  Incorrect expression  (DIVIDE_BY_ZERO)
/emfio/source/reader/mtftools.cxx: 423 in emfio::ScaledFontDetectCorrectHelper::evaluateAlternativeFontScale(const rtl::OUString &, long)()


________________________________________________________________________________________________________
*** CID 1473322:  Incorrect expression  (DIVIDE_BY_ZERO)
/emfio/source/reader/mtftools.cxx: 423 in emfio::ScaledFontDetectCorrectHelper::evaluateAlternativeFontScale(const rtl::OUString &, long)()
417                         vcl::Font rFontCandidate2(rFontCandidate);
418                         rFontCandidate2.SetAverageFontWidth(static_cast<tools::Long>(fCorrectedAverageFontWidth));
419                         pTempVirtualDevice->SetFont(rFontCandidate2);
420                         nCorrectedTextLength = pTempVirtualDevice->GetTextWidth(rText);
421                     }
422     
>>>     CID 1473322:  Incorrect expression  (DIVIDE_BY_ZERO)
>>>     In expression "static_cast<double>(nImportedTextLength) / static_cast<double>(nCorrectedTextLength)", division by expression "nCorrectedTextLength" which may be zero has undefined behavior.
423                     const double fFactorCorrectedText(static_cast<double>(nImportedTextLength) / static_cast<double>(nCorrectedTextLength));
424                     const double fFactorCorrectedTextPercent(fabs(1.0 - fFactorCorrectedText) * 100.0);
425     
426                     // If FactorCorrectedText fits better than FactorText this is probably
427                     // an import of an old EMF/WMF written by LibreOffice on a non-Windows (unx) system
428                     // and should be corrected.

** CID 1473321:  Incorrect expression  (DIVIDE_BY_ZERO)
/emfio/source/reader/mtftools.cxx: 394 in emfio::ScaledFontDetectCorrectHelper::evaluateAlternativeFontScale(const rtl::OUString &, long)()


________________________________________________________________________________________________________
*** CID 1473321:  Incorrect expression  (DIVIDE_BY_ZERO)
/emfio/source/reader/mtftools.cxx: 394 in emfio::ScaledFontDetectCorrectHelper::evaluateAlternativeFontScale(const rtl::OUString &, long)()
388                 pTempVirtualDevice->SetFont(rFontCandidate);
389                 const tools::Long nMeasuredTextLength(pTempVirtualDevice->GetTextWidth(rText));
390     
391                 // compare expected and imported TextLengths
392                 if(nImportedTextLength != nMeasuredTextLength)
393                 {
>>>     CID 1473321:  Incorrect expression  (DIVIDE_BY_ZERO)
>>>     In expression "static_cast<double>(nImportedTextLength) / static_cast<double>(nMeasuredTextLength)", division by expression "nMeasuredTextLength" which may be zero has undefined behavior.
394                     const double fFactorText(static_cast<double>(nImportedTextLength) / static_cast<double>(nMeasuredTextLength));
395                     const double fFactorTextPercent(fabs(1.0 - fFactorText) * 100.0);
396     
397                     // if we assume that loaded file was written on old linux, we have to
398                     // back-convert the scale value depending on which system we run
399     #ifdef _WIN32


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3DOLSO_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJiLJUfyb0bF1Q9zS-2BNbCP2cZKHvpzgfJskEVYkiDf36tpw85TtTyLedRtE1EsbQ7-2BgA1WVXNpRxGMhMnX22N6-2BB6wiQx-2FbHXCQM2ijzc-2F5HeHYtwe3KlXd5DDpiSAYqzieAHbsnyqPissAei0v8x7bJXUPdrUETCREzGlelyXlLaGBj7Jr7qs92WHR9hbbtx-2Fv

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux