New Defects reported by Coverity Scan for LibreOffice
scan-admin at coverity.com
scan-admin at coverity.com
Fri Jan 15 00:45:05 PST 2016
Hi,
Please find the latest report on new defect(s) introduced to LibreOffice found with Coverity Scan.
7 new defect(s) introduced to LibreOffice found with Coverity Scan.
29 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 7 of 7 defect(s)
** CID 1348472: (UNUSED_VALUE)
/editeng/source/misc/svxacorr.cxx: 1258 in SvxAutoCorrect::DoAutoCorrect(SvxAutoCorrDoc &, const rtl::OUString &, int, char16_t, bool, vcl::Window *)()
/editeng/source/misc/svxacorr.cxx: 1275 in SvxAutoCorrect::DoAutoCorrect(SvxAutoCorrDoc &, const rtl::OUString &, int, char16_t, bool, vcl::Window *)()
________________________________________________________________________________________________________
*** CID 1348472: (UNUSED_VALUE)
/editeng/source/misc/svxacorr.cxx: 1258 in SvxAutoCorrect::DoAutoCorrect(SvxAutoCorrDoc &, const rtl::OUString &, int, char16_t, bool, vcl::Window *)()
1252 // Hardspaces autocorrection
1253 if ( IsAutoCorrFlag( AddNonBrkSpace ) )
1254 {
1255 if ( NeedsHardspaceAutocorr( cChar ) &&
1256 FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos ) ) )
1257 {
>>> CID 1348472: (UNUSED_VALUE)
>>> Assigning value "4UL" to "nRet" here, but that stored value is overwritten before it can be used.
1258 nRet = AddNonBrkSpace;
1259 }
1260 else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
1261 {
1262 // Remove the NBSP if it wasn't an autocorrection
1263 if ( nInsPos != 0 && NeedsHardspaceAutocorr( rTxt[ nInsPos - 1 ] ) &&
/editeng/source/misc/svxacorr.cxx: 1275 in SvxAutoCorrect::DoAutoCorrect(SvxAutoCorrDoc &, const rtl::OUString &, int, char16_t, bool, vcl::Window *)()
1269 while ( bContinue )
1270 {
1271 const sal_Unicode cTmpChar = rTxt[ nPos ];
1272 if ( cTmpChar == cNonBreakingSpace )
1273 {
1274 rDoc.Delete( nPos, nPos + 1 );
>>> CID 1348472: (UNUSED_VALUE)
>>> Assigning value "4UL" to "nRet" here, but that stored value is overwritten before it can be used.
1275 nRet = AddNonBrkSpace;
1276 bContinue = false;
1277 }
1278 else if ( !NeedsHardspaceAutocorr( cTmpChar ) || nPos == 0 )
1279 bContinue = false;
1280 nPos--;
** CID 1348471: Uninitialized members (UNINIT_CTOR)
/filter/source/svg/gfxtypes.hxx: 187 in svgi::State::State()()
________________________________________________________________________________________________________
*** CID 1348471: Uninitialized members (UNINIT_CTOR)
/filter/source/svg/gfxtypes.hxx: 187 in svgi::State::State()()
181 meLineJoin(basegfx::B2DLineJoin::Miter),
182 mnMiterLimit(4.0),
183 mnStrokeWidth(1.0),
184 maViewportFillColor(1.0),
185 maViewportFillGradient(Gradient::LINEAR),
186 mnStyleId(0)
>>> CID 1348471: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "mnParentFontSize" is not initialized in this constructor nor in any functions that it calls.
187 {}
188
189 basegfx::B2DHomMatrix maCTM;
190 basegfx::B2DHomMatrix maTransform;
191 basegfx::B2DRange maViewport;
192 basegfx::B2DRange maViewBox;
** CID 1348470: Control flow issues (MISSING_BREAK)
/writerfilter/source/rtftok/rtfdocumentimpl.cxx: 3503 in writerfilter::rtftok::RTFDocumentImpl::dispatchFlag(writerfilter::rtftok::RTFKeyword)()
________________________________________________________________________________________________________
*** CID 1348470: Control flow issues (MISSING_BREAK)
/writerfilter/source/rtftok/rtfdocumentimpl.cxx: 3503 in writerfilter::rtftok::RTFDocumentImpl::dispatchFlag(writerfilter::rtftok::RTFKeyword)()
3497 case RTF_LANDSCAPE:
3498 {
3499 auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape);
3500 lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
3501 NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, pValue);
3502 }
>>> CID 1348470: Control flow issues (MISSING_BREAK)
>>> The above case falls through to this one.
3503 case RTF_LNDSCPSXN:
3504 {
3505 auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape);
3506 lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
3507 NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, pValue);
3508 }
** CID 1348469: Incorrect expression (IDENTICAL_BRANCHES)
/vcl/source/window/winproc.cxx: 1975 in ImplHandleUserEvent(ImplSVEvent *)()
________________________________________________________________________________________________________
*** CID 1348469: Incorrect expression (IDENTICAL_BRANCHES)
/vcl/source/window/winproc.cxx: 1975 in ImplHandleUserEvent(ImplSVEvent *)()
1969 static void ImplHandleUserEvent( ImplSVEvent* pSVEvent )
1970 {
1971 if ( pSVEvent )
1972 {
1973 if ( pSVEvent->mbCall && !pSVEvent->maDelData.IsDead() )
1974 {
>>> CID 1348469: Incorrect expression (IDENTICAL_BRANCHES)
>>> The same code is executed regardless of whether "pSVEvent->mpWindow.operator bool()" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
1975 if ( pSVEvent->mpWindow )
1976 {
1977 pSVEvent->maLink.Call( pSVEvent->mpData );
1978 }
1979 else
1980 {
** CID 1348468: Incorrect expression (COPY_PASTE_ERROR)
/oox/source/drawingml/shape.cxx: 521 in oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase &, const rtl::OUString &, const oox::drawingml::Theme *, const com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> &, const com::sun::star::awt::Rectangle *, bool, bool, basegfx::B2DHomMatrix &, oox::drawingml::FillProperties &)()
________________________________________________________________________________________________________
*** CID 1348468: Incorrect expression (COPY_PASTE_ERROR)
/oox/source/drawingml/shape.cxx: 521 in oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase &, const rtl::OUString &, const oox::drawingml::Theme *, const com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> &, const com::sun::star::awt::Rectangle *, bool, bool, basegfx::B2DHomMatrix &, oox::drawingml::FillProperties &)()
515 // Guard against zero width or height.
516 if (i)
517 {
518 const basegfx::B2DPoint& rPreviousPoint = aPoly.getB2DPoint(i - 1);
519 if (aPoint.getX() - rPreviousPoint.getX() == 0)
520 aPoint.setX(aPoint.getX() + 1);
>>> CID 1348468: Incorrect expression (COPY_PASTE_ERROR)
>>> "getX" in "rPreviousPoint->getX()" looks like a copy-paste error.
521 if (aPoint.getY() - rPreviousPoint.getX() == 0)
522 aPoint.setY(aPoint.getY() + 1);
523 }
524
525 if (bIsWriter && bInGroup)
526 // Writer's draw page is in twips, and these points get passed
** CID 1348467: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
/filter/source/svg/svgreader.cxx: 411 in svgi::<unnamed>::AnnotatingVisitor::operator ()(const com::sun::star::uno::Reference<com::sun::star::xml::dom::XElement> &, const com::sun::star::uno::Reference<com::sun::star::xml::dom::XNamedNodeMap> &)()
________________________________________________________________________________________________________
*** CID 1348467: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
/filter/source/svg/svgreader.cxx: 411 in svgi::<unnamed>::AnnotatingVisitor::operator ()(const com::sun::star::uno::Reference<com::sun::star::xml::dom::XElement> &, const com::sun::star::uno::Reference<com::sun::star::xml::dom::XNamedNodeMap> &)()
405 if( XML_ID == nTokenId )
406 {
407 maElementVector.push_back(xElem);
408 maElementIdMap.insert(std::make_pair(sAttributeValue,
409 maElementVector.size() - 1));
410 }
>>> CID 1348467: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
>>> The "or" condition "nTokenId != 45 || nTokenId != 310" will always be true because "nTokenId" cannot be equal to two different values at the same time, so it must be not equal to at least one of them.
411 else if ( nTokenId != XML_COLOR || nTokenId != XML_STYLE )
412 parseAttribute(nTokenId,
413 sAttributeValue);
414 }
415
416 // all attributes parsed, can calc total CTM now
** CID 1348466: Error handling issues (CHECKED_RETURN)
/basic/source/basmgr/basmgr.cxx: 1357 in BasicManager::LoadLib(unsigned short)()
________________________________________________________________________________________________________
*** CID 1348466: Error handling issues (CHECKED_RETURN)
/basic/source/basmgr/basmgr.cxx: 1357 in BasicManager::LoadLib(unsigned short)()
1351 BasicLibInfo& rLibInfo = *mpImpl->aLibs[nLib];
1352 uno::Reference< script::XLibraryContainer > xLibContainer = rLibInfo.GetLibraryContainer();
1353 if( xLibContainer.is() )
1354 {
1355 OUString aLibName = rLibInfo.GetLibName();
1356 xLibContainer->loadLibrary( aLibName );
>>> CID 1348466: Error handling issues (CHECKED_RETURN)
>>> Calling "isLibraryLoaded" without checking return value (as is done elsewhere 39 out of 40 times).
1357 xLibContainer->isLibraryLoaded( aLibName );
1358 }
1359 else
1360 {
1361 ImpLoadLibrary( &rLibInfo, nullptr );
1362 StarBASIC* pLib = GetLib( nLib );
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/libreoffice?tab=overview
To manage Coverity Scan email notifications for "libreoffice at lists.freedesktop.org", click https://scan.coverity.com/subscriptions/edit?email=libreoffice%40lists.freedesktop.org&token=d6481d718a775246b2340f282ebe5939
More information about the LibreOffice
mailing list