LibreOfficeã¯ã32/64ãããã·ã¹ãã ãšå®å šã«äºææ§ã®ãã匷åãªãªãã£ã¹ã¹ã€ãŒãã§ãã äžçã®30以äžã®èšèªã«ç¿»èš³ãããŠããŸãã GNU / LinuxãMicrosoft WindowsãMac OS Xãªã©ãã»ãšãã©ã®äžè¬çãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ããµããŒãããŠããŸãã
LibreOfficeã¯ç¡æã®ãªãŒãã³ãœãŒã¹ã§ãã JavaãPythonãC ++ã®èšèªã§æžãããŠããŸãã C ++ïŒããã³Cã C ++ / CLIã§å°ãïŒã§èšè¿°ããããããžã§ã¯ãã®éšåãåæãããŸãã ã ããŒãžã§ã³ïŒ4.5.0.0.alpha0 +ïŒGitãªããžã§ã³ïŒ368367ïŒã
åæã¯ã PVS-Studioéçã³ãŒãã¢ãã©ã€ã¶ãŒã䜿çšããŠå®è¡ãããŸããã
ã©ã®ãšã©ãŒãæ€åºããããããã§äœãã§ããããæ€èšããŠãã ããã äžéšã®ãšã©ãŒã¯ãšã©ãŒã§ã¯ãªãå¯èœæ§ãããããšã«æ³šæããŠãã ããã ç§ã¯ã³ãŒãã«è©³ãããªãã®ã§ãå®å šã«æ£ããã³ãŒãããšã©ãŒãšééããå¯èœæ§ããããŸãã ãããããã®ã³ãŒãã¯ã¢ãã©ã€ã¶ãŒãšç§ãå°æãããã®ã§ãäœããééã£ãŠããŸãã ãã®ã³ãŒãã¯èããããã®ã§ããããžã§ã¯ãã®éçºäžã«èª€è§£ãããå¯èœæ§ãæžããããã«ãªãã¡ã¯ã¿ãªã³ã°ããã®ãè¯ãã§ãããã
ã¿ã€ããã¹
ã©ããªã³ãŒããã¿ã€ããã¹ãªãã§ã¯ã§ããŸããã ãã¡ãããå€ãã¯ãã¹ã段éã§çºèŠããä¿®æ£ãããŸãããäžéšã¯ããã°ã©ã å ã§é·æéåç¶ããŸãã ååãšããŠããããã¯ãã£ãã«äœ¿çšãããªãé¢æ°ã«ããããããã°ã©ã ã«åŒ·ã圱é¿ãäžããŸããã
ããšãã°ã3åã®1ã ãã§æ©èœãããã®ãããªæ¯èŒé¢æ°ããããŸããã
class SvgGradientEntry { .... bool operator==(const SvgGradientEntry& rCompare) const { return (getOffset() == rCompare.getOffset() && getColor() == getColor() && getOpacity() == getOpacity()); } .... }
PVS-StudioèŠåïŒ V501 ã==ãæŒç®åã®å·Šå³ã«åãå¯æ¬¡åŒããããŸãïŒgetColorïŒïŒ== getColorïŒïŒsvggradientprimitive2d.hxx 61
ããããããã®ééãã¯ããã»ã©å®³ããããããªãã§ãããã ããããããã®æŒç®åã==ãã¯ãŸã£ãã䜿çšãããŠããŸããã ãã ããã¢ãã©ã€ã¶ãŒã¯ãã®ãšã©ãŒãæ€åºã§ãããããæ°ããã³ãŒããäœæããçŽåŸã«ãããæ·±å»ãªãšã©ãŒãæ€åºã§ããŸãã ãããã£ãŠãéçåæã®äž»ãªäŸ¡å€ã¯ã1åéãã®å®è¡ã§ã¯ãªããå®æçãªäœ¿çšã§ãã
ãã®ãããªãšã©ãŒãåé¿ããã«ã¯ã©ãããã°ããã§ããããïŒ ç¥ããŸãã ãããããåãã¿ã€ãã®ã³ãŒãã®ãããã¯ããã泚ææ·±ãæŽåãããããšã«æ £ãããšããšã©ãŒã¯ããé¡èã«ãªããŸãã ããšãã°ãé¢æ°ã¯æ¬¡ã®ããã«èšè¿°ã§ããŸãã
bool operator==(const SvgGradientEntry& rCompare) const { return getOffset() == rCompare.getOffset() && getColor() == getColor() && getOpacity() == getOpacity(); }
å³åŽã®åã«ãrCompareããæ¬ èœããŠããããšãããé¡èã«ãªããŸããã æ£çŽã«èšã£ãŠãããã»ã©é¡èã§ã¯ãããŸããã å©ãã«ãªããªããããããŸããã 誀ãããšã¯äººéã§ãã ãããã£ãŠãéçã¢ãã©ã€ã¶ãŒã¯è¯ããã«ããŒã«ãªããŸãã
ãããŠãã¿ã€ããã¹ãæããã«åé¿ã§ããäŸã§ãã 誰ãã2ã€ã®å€æ°éã§å€ã亀æããããã«ã³ãŒããèšè¿°ã§ããŸããã§ããã
void TabBar::ImplGetColors(....) { .... aTempColor = rFaceTextColor; rFaceTextColor = rSelectTextColor; rSelectTextColor = rFaceTextColor; .... }
èŠåPVS-StudioïŒ V587ãã®çš®ã®å²ãåœãŠã®å¥æ°ã·ãŒã±ã³ã¹ïŒA = B; B = A;ã è¡ã確èªããŠãã ããïŒ565ã566ãtabbar.cxx 566
æåŸã®è¡ã§ã¯ããrFaceTextColorãã§ã¯ãªããaTempColorãã䜿çšããå¿ èŠããããŸãã
å€ããæåã§ã亀æããã³ãŒããèšè¿°ããå¿ èŠã¯ãããŸããã§ããã æšæºé¢æ°std :: swapïŒïŒã䜿çšããæ¹ãç°¡åã§ä¿¡é Œæ§ãé«ããªããŸãã
swap(rFaceTextColor, rSelectTextColor);
ç¶ããŸãããã 次ã®ééããé²ãããšã¯äžå¯èœã ãšæããŸãã çŽç²ãªã¿ã€ããã¹ïŒ
void SAL_CALL Theme::disposing (void) { ChangeListeners aListeners; maChangeListeners.swap(aListeners); const lang::EventObject aEvent (static_cast<XWeak*>(this)); for (ChangeListeners::const_iterator iContainer(maChangeListeners.begin()), iContainerEnd(maChangeListeners.end()); iContainerEnd!=iContainerEnd; ++iContainerEnd) { .... } }
PVS-StudioèŠåïŒV501 'ïŒ='æŒç®åã®å·Šå³ã«åãå¯æ¬¡åŒããããŸãïŒiContainerEndïŒ= IContainerEnd theme.cxx 439
æ¡ä»¶ãiContainerEndïŒ= IContainerEndãã¯åžžã«falseã§ãããããã«ãŒãã¯å®è¡ãããŸããã ã€ãã¬ãŒã¿ã®åæ§ã®ååããŸãšããŸããã å®éã«ã¯ããiContainerïŒ= IContainerEndããšèšè¿°ããå¿ èŠããããŸããã ãšããã§ãããã«ã¯å¥ã®ééããããããã§ãã iContainerEndã€ãã¬ãŒã¿ãå¢ããŠããã®ã¯å¥åŠã§ãã
å¥ã®å€±æããã«ãŒããèããŠã¿ãŸãããïŒ
static void lcl_FillSubRegionList(....) { .... for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin(); <<<<---- ppMark != pMarkAccess->getBookmarksBegin(); <<<<---- ++ppMark) { const ::sw::mark::IMark* pBkmk = ppMark->get(); if( pBkmk->IsExpanded() ) rSubRegions.InsertEntry( pBkmk->GetName() ); } }
èŠåPVS-StudioïŒV625ãforãæŒç®åã®æ€æ»ãæ€èšããŠãã ããã ã€ãã¬ãŒã¿ã®åæå€ãšæçµå€ã¯åãã§ãã uiregionsw.cxx 120
ã«ãŒãã¯å®è¡ãããŸããã æ¡ä»¶ã§ã¯ãã€ãã¬ãŒã¿ 'ppMark'ã 'pMarkAccess-> getBookmarksEndïŒïŒ'ãšæ¯èŒããå¿ èŠããããŸãã ã³ãŒãèšè¿°ã«ãŒã«ã®å©ããåããŠããã®ãããªãšã©ãŒãã身ãå®ãæ¹æ³ã¯ãããŸããã ãã ã®ã¿ã€ããã¹ã
ãšããã§ãæã ãšã©ãŒããããŸãããããã°ã©ã ã®æ£ããå®è¡ã«ã¯åœ±é¿ããŸããã 次ã«ããããã®ã¿ã€ããã¹ã®1ã€ã瀺ããŸãã
bool PolyPolygonEditor::DeletePoints(....) { bool bPolyPolyChanged = false; std::set< sal_uInt16 >::const_reverse_iterator aIter;( rAbsPoints.rbegin() ); for( aIter = rAbsPoints.rbegin(); aIter != rAbsPoints.rend(); ++aIter ) .... }
PVS-StudioèŠåïŒ V530é¢æ° 'rbegin'ã®æ»ãå€ã䜿çšããå¿ èŠããããŸãã polypolygoneditor.cxx 38
ãšã©ãŒã¯ããã«ãããŸãïŒaIter;ïŒrAbsPoints.rbeginïŒïŒïŒ;
圌ãã¯ã€ãã¬ãŒã¿ãåæåãããã£ãã ãããã誀ã£ãŠã»ãã³ãã³ãããã³ç¶ã«ãªã£ãŠããŸãã ã€ãã¬ãŒã¿ã¯åæåãããŠããŸããã ãããŠãåŒãïŒrAbsPoints.rbeginïŒïŒïŒ;ã 空äžã§ã¶ãã¶ãããŠäœãããŸããã
ãã®ç¶æ³ã¯ãã«ãŒãå ã§ã€ãã¬ãŒã¿ãŒãç®çã®å€ã§åæåãããŠãããšããäºå®ã«ãã£ãŠä¿åãããŸãã äžè¬ã«ããšã©ãŒã¯ãããŸããããéå°ãªè¡šçŸãåé€ããããšããå§ãããŸãã ã¡ãªã¿ã«ããã®ãµã€ã¯ã«ã¯ã³ããŒããŒã¹ãã䜿çšããŠäŒæããããããåããã¡ã€ã«ã®69è¡ç®ãš129è¡ç®ãèŠã䟡å€ããããŸãã
æåŸã«ãã¯ã©ã¹ã³ã³ã¹ãã©ã¯ã¿ãŒã®ã¿ã€ããã¹ïŒ
XMLTransformerOOoEventMap_Impl::XMLTransformerOOoEventMap_Impl( XMLTransformerEventMapEntry *pInit, XMLTransformerEventMapEntry *pInit2 ) { if( pInit ) AddMap( pInit ); if( pInit ) AddMap( pInit2 ); }
PVS-StudioèŠåïŒV581äºãã«äžŠãã§ãããifãæŒç®åã®æ¡ä»¶åŒã¯åäžã§ãã è¡ã確èªããŠãã ããïŒ77ã79ãeventoootcontext.cxx 79
2çªç®ã®ifã¹ããŒãã¡ã³ãã¯pInit2ãã€ã³ã¿ãŒããã§ãã¯ããå¿ èŠããããŸãã
èšç»ã©ãããããããŸããããéåžžã«çããã
ã¿ã€ããã¹ãå«ããšæãããã³ãŒãã¹ãããããããã€ããããŸãã ããããç§ã«ã¯ããããŸããã ãããããããæå³ããããã®ã§ãã
class VCL_DLLPUBLIC MouseSettings { .... long GetStartDragWidth() const; long GetStartDragHeight() const; .... } bool ImplHandleMouseEvent( .... ) { .... long nDragW = rMSettings.GetStartDragWidth(); long nDragH = rMSettings.GetStartDragWidth(); .... }
èŠåïŒ V656å€æ° 'nDragW'ã 'nDragH'ã¯ãåãé¢æ°ã®åŒã³åºãã«ãã£ãŠåæåãããŸãã ãããããšã©ãŒãŸãã¯æé©åãããŠããªãã³ãŒãã§ãã ãrMSettings.GetStartDragWidthïŒïŒãåŒã調ã¹ãããšãæ€èšããŠãã ããã è¡ã確èªããŠãã ããïŒ471ã472ãwinproc.cxx 472
å€æ°nDragWãšnDragHãåãå€ã§åæåããå¿ èŠããããã©ããã¯æ確ã§ã¯ãããŸããã ãã®å Žåãååãªã³ã¡ã³ãããããŸããã ãŸãã¯ãæ瀺çã«èšè¿°ããæ¹ãè¯ãã§ãããïŒ
long nDragW = rMSettings.GetStartDragWidth(); long nDragH = nDragW;
åæ§ã®ç¶æ³ïŒ
void Edit::ImplDelete(....) { .... maSelection.Min() = aSelection.Min(); maSelection.Max() = aSelection.Min(); .... }
V656å€æ°ãmaSelection.MinïŒïŒãããmaSelection.MaxïŒïŒãã¯ãåãé¢æ°ã®åŒã³åºãã«ãã£ãŠåæåãããŸãã ãããããšã©ãŒãŸãã¯æé©åãããŠããªãã³ãŒãã§ãã ãaSelection.MinïŒïŒãåŒã®æ€æ»ãæ€èšããŠãã ããã è¡ã確èªããŠãã ããïŒ756ã757ãedit.cxx 757
ãããžã§ã¯ãã§äœæ¥ãã人ã«ãšã£ãŠãããã®ãã¹ãŠã¯ããã«æããã§ãã ç§ã¯åããŠããªãã®ã§ãããã«ãšã©ãŒããããã©ããã¯ããããŸããã
ãããŠæåŸã®ã±ãŒã¹ã ã¯ã©ã¹ã«ã¯3ã€ã®é¢æ°ããããŸãã
- GetVRPïŒïŒ
- GetVPNïŒïŒ
- GetVUVïŒïŒ
void ViewContactOfE3dScene::createViewInformation3D(....) { .... const basegfx::B3DPoint aVRP(rSceneCamera.GetVRP()); const basegfx::B3DVector aVPN(rSceneCamera.GetVRP()); <<<--- const basegfx::B3DVector aVUV(rSceneCamera.GetVUV()); .... }
PVS-StudioèŠåïŒV656å€æ°ãaVRPãããaVPNãã¯ãåãé¢æ°ã®åŒã³åºãã«ãã£ãŠåæåãããŸãã ãããããšã©ãŒãŸãã¯æé©åãããŠããªãã³ãŒãã§ãã ãrSceneCamera.GetVRPïŒïŒãåŒã®æ€æ»ãæ€èšããŠãã ããã è¡ã確èªããŠãã ããïŒ177ã178ãviewcontactofe3dscene.cxx 178
ã¢ãã©ã€ã¶ãŒã¯å¥ã®èŠåV656ãçºè¡ããŸããã æ¬åœã®ééãããããšç¢ºä¿¡ããŠããŸãã ããããé¢åãªã®ã§ã³ãŒãã¯åŒçšããŸããã éçºè ã«ãããèŠãŠããããŸãïŒ
- V656å€æ°ãoNumOffset1ãããoNumOffset2ãã¯ãåãé¢æ°ã®åŒã³åºãã«ãã£ãŠåæåãããŸãã ãããããšã©ãŒãŸãã¯æé©åãããŠããªãã³ãŒãã§ãã è¡ããã§ãã¯ããŠãã ããïŒ68ã69ãfindattr.cxx 69
ã³ããŒããŒã¹ã
Copy-Pasteããªããã°ãããã°ã©ãã³ã°ã¯éåžžã«éå±ã§éå±ã«ãªãããšããããŸãã Ctrl-CãCtrl-Vããªããšããããã®ããŒããŒãã·ã§ãŒãã«ãããã©ã®ããã«ç¡å¹ã«ããŠããããã°ã©ãã³ã°ã¯æ©èœããŸããã ãããã£ãŠãã³ãŒããã³ããŒããªãã§ãã ããã ãã ããã³ãŒããã³ããŒãããšãã¯æ³šæããŠãã ããã
uno::Sequence< OUString > SwXTextTable::getSupportedServiceNames(void) { uno::Sequence< OUString > aRet(4); OUString* pArr = aRet.getArray(); pArr[0] = "com.sun.star.document.LinkTarget"; pArr[1] = "com.sun.star.text.TextTable"; pArr[2] = "com.sun.star.text.TextContent"; pArr[2] = "com.sun.star.text.TextSortable"; return aRet; }
PVS-StudioèŠåïŒ V519 ãpArr [2]ãå€æ°ã«ã¯å€ãé£ç¶ããŠ2åå²ãåœãŠãããŸãã ããããããã¯ééãã§ãã è¡ã確èªããŠãã ããïŒ3735ã3736ãunotbl.cxx 3736
æåŸã®è¡ã®å€å žçãªå¹æ ã æåŸã®è¡ã¯æåŸãã2çªç®ã®è¡ããååŸããããšç¢ºä¿¡ããŠããŸãã ãã³ã³ãã³ãããããœãŒãå¯èœãã«çœ®ãæããŸããããã2ãã€ã³ããã¯ã¹ãå¿ããŠããŸããã
éåžžã«ãã䌌ãã±ãŒã¹ïŒ
Sequence<OUString> FirebirdDriver::getSupportedServiceNames_Static() { Sequence< OUString > aSNS( 2 ); aSNS[0] = "com.sun.star.sdbc.Driver"; aSNS[0] = "com.sun.star.sdbcx.Driver"; return aSNS; }
PVS-StudioèŠåïŒV519ãaSNS [0]ãå€æ°ã«ã¯ãå€ãé£ç¶ããŠ2åå²ãåœãŠãããŸãã ããããããã¯ééãã§ãã è¡ã確èªããŠãã ããïŒ137ã138ãdriver.cxx 138
ããããææªã®ããšã¯ãã³ããŒãšè²Œãä»ãã®ãšã©ãŒã®ãããã§æã äŒæããããšã§ãã ãããäŸã§ç€ºããŸãã æ®å¿µãªãããã³ãŒããèªãã®ã¯å°ãé£ããã§ãããã ææ ¢ããŠãã ããã
ãã®ãããããã°ã©ã ã«ã¯æ¬¡ã®æ©èœããããŸãã
static bool GetPropertyValue( ::com::sun::star::uno::Any& rAny, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, const OUString& rPropertyName, bool bTestPropertyAvailability = false );
'bTestPropertyAvailability'ã®æåŸã®åŒæ°ã¯ãªãã·ã§ã³ã§ããããšã«æ³šæããŠãã ããã
ãŸãããsal_Trueããšã¯æ¬¡ã®ãšããã§ãã
#define sal_True ((sal_Bool)1)
ããã§å®éã®ãšã©ãŒã GetPropertyValueïŒïŒé¢æ°ã®åŒã³åºãæ¹æ³ãåç §ããŠãã ããã
sal_Int32 PPTWriterBase::GetLayoutOffset(....) const { ::com::sun::star::uno::Any aAny; sal_Int32 nLayout = 20; if ( GetPropertyValue( aAny, rXPropSet, OUString( "Layout" ) ), sal_True ) aAny >>= nLayout; DBG(printf("GetLayoutOffset %" SAL_PRIdINT32 "\n", nLayout)); return nLayout; }
PVS-StudioèŠåïŒ V639 ãGetPropertyValueãé¢æ°åŒã³åºãã®åŒã調ã¹ãããšãæ€èšããŠãã ããã éãæ¬åŒ§ 'ïŒ'ã®1ã€ã誀ã£ãŠé 眮ãããå¯èœæ§ããããŸãã pptx-epptbase.cxx 442
ããèŠããšãéãæ¬åŒ§ã®1ã€ããã®å Žæã«ãªãããšãããããŸãã ãã®çµæãGetPropertyValueïŒïŒé¢æ°ã¯ãæåŸã®åŒæ°ãšããŠãsal_Trueãã§ã¯ãªããããã©ã«ãå€ïŒãfalseãã«çããïŒãåãåããŸãã
ããããããã¯åé¡ã®ååã«éããŸããã ããã«ããifãæŒç®åã®äœæ¥ãå°ç¡ãã«ãªããŸããã ç¶æ ã¯æ¬¡ã®ããã«ãªããŸãã
if (foo(), sal_True)
ã³ã³ãæŒç®åã¯å³åŽãè¿ããŸãã ãã®çµæãæ¡ä»¶ã¯åžžã«çã«ãªããŸãã
ãã®ã³ãŒãã®ãšã©ãŒã¯ãCopy-Pasteãšã¯é¢ä¿ãããŸããã éåžžã®ã¿ã€ããã¹ã ãã©ã±ããã¯ãããŸããã ããã¯èµ·ãããŸãã
æ²ããããšã¯ããã®ãšã©ãŒãããã°ã©ã ã®ä»ã®éšåã«äŒæãããããšã§ãã ããå Žæã§ééããä¿®æ£ãããå Žåãä»ã®å Žæã§ã¯ééããæ®ãå¯èœæ§ãé«ããªããŸãã
Copy-Pasteã«ãããããã«9ãæã§ãã®ãšã©ãŒãçºçããŸããã
- epptso.cxx 993
- epptso.cxx 3677
- pptx-text.cxx 518
- pptx-text.cxx 524
- pptx-text.cxx 546
- pptx-text.cxx 560
- pptx-text.cxx 566
- pptx-text.cxx 584
- pptx-text.cxx 590
#define CHECK_N_TRANSLATE( name ) \ else if (sServiceName == SERVICE_PERSISTENT_COMPONENT_##name) \ sToWriteServiceName = SERVICE_##name void OElementExport::exportServiceNameAttribute() { .... CHECK_N_TRANSLATE( FORM ); <<<<---- CHECK_N_TRANSLATE( FORM ); <<<<---- CHECK_N_TRANSLATE( LISTBOX ); CHECK_N_TRANSLATE( COMBOBOX ); CHECK_N_TRANSLATE( RADIOBUTTON ); CHECK_N_TRANSLATE( GROUPBOX ); CHECK_N_TRANSLATE( FIXEDTEXT ); CHECK_N_TRANSLATE( COMMANDBUTTON ); .... }
PVS-Studio èŠå ïŒ V517 ãifïŒAïŒ{...} else ifïŒAïŒ{...}ããã¿ãŒã³ã®äœ¿çšãæ€åºãããŸããã è«çãšã©ãŒãååšããå¯èœæ§ããããŸãã è¡ã確èªããŠãã ããïŒ177ã178ãelementexport.cxx 177
äœãåé¡ã¯ãããŸããããæ¬ é¥ããããŸãã ããã«2ã€ã®è¿œå ãã§ãã¯ãããã«ãããŸãïŒ
- querydesignview.cxx 3484
- querydesignview.cxx 3486
reallocïŒïŒé¢æ°ã®åæ¢ãªäœ¿çš
reallocïŒïŒé¢æ°ã䜿çšãããŠããã®ã§ãæããã«å®å šã§ã¯ãªãã®ã§ãééããšåŒã¶ãªã¹ã¯ã¯ãããŸããã ã©ããããããã¯èè ã®æèçãªæ±ºå®ã§ãã mallocïŒïŒ/ reallocïŒïŒã䜿çšããŠã¡ã¢ãªãå²ãåœãŠãããšã¯ã§ããªãã£ãã®ã§ãããã°ã©ã ãããã«èœãšããŠãã ããã ãããã¯ããããã®ã¯äœããããŸããã ãšã«ãããããã°ã©ã ãåŒãç¶ãæ©èœããå ŽåããããããŸãããå¯èœæ§ã¯äœãã§ãã ãã ããã¢ãã©ã€ã¶ãŒã«ãã£ãŠçºè¡ãããã¡ãã»ãŒãžã誀æ€ç¥ãšããŠã«ãŠã³ãããããšã¯ãã§ã¢ã§ã¯ãããŸããã ãããã£ãŠãã¢ãã©ã€ã¶ãŒãæ°ã«å ¥ããªãã£ãç¹ãæ€èšããŠãã ããã
ããšãã°ãFastAttributeListã¯ã©ã¹ã®addïŒïŒé¢æ°ã®å®è£ ã調ã¹ãŸãã
void FastAttributeList::add(sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength ) { maAttributeTokens.push_back( nToken ); sal_Int32 nWritePosition = maAttributeValues.back(); maAttributeValues.push_back( maAttributeValues.back() + nValueLength + 1 ); if (maAttributeValues.back() > mnChunkLength) { mnChunkLength = maAttributeValues.back(); mpChunk = (sal_Char *) realloc( mpChunk, mnChunkLength ); } strncpy(mpChunk + nWritePosition, pValue, nValueLength); mpChunk[nWritePosition + nValueLength] = '\0'; }
PVS-Studio èŠå ïŒ V701 reallocïŒïŒãªãŒã¯ã®å¯èœæ§ïŒreallocïŒïŒãã¡ã¢ãªã®å²ãåœãŠã«å€±æãããšãå ã®ãã€ã³ã¿ãŒ 'mpChunk'ã倱ãããŸãã reallocïŒïŒãäžæãã€ã³ã¿ãŒã«å²ãåœãŠãããšãæ€èšããŠãã ããã fastattribs.cxx 88
ãã®ã³ãŒãã®äž»ãªåé¡ã¯ãreallocïŒïŒé¢æ°ã®çµæããã§ãã¯ãããªãããšã§ãã ãã¡ãããã¡ã¢ãªãå²ãåœãŠãããšãã§ããªãç¶æ³ã¯éåžžã«ãŸãã§ãã ããããæ³åããŠãã ãã-ãããèµ·ãã£ãã 次ã«ãreallocïŒïŒã¯NULLãè¿ããŸãã 次ã«ãstrncpyïŒïŒé¢æ°ãããŒã¿ã®ã³ããŒãéå§ãããšãç·æ¥äºæ ãçºçããŸãã
mpChunk = (sal_Char *) realloc( mpChunk, mnChunkLength ); } strncpy(mpChunk + nWritePosition, pValue, nValueLength);
ããããã¢ãã©ã€ã¶ãŒã¯ããäžæ¹ã奜ãã§ã¯ãããŸããã äœããã®çš®é¡ã®ãšã©ãŒãã³ãã©ããããšããŸãã ãããŠãããã°ã©ã ã¯å®è¡ãç¶ããŸãã ããã¯åãªãã¡ã¢ãªãªãŒã¯ã§ãã mpChunkå€æ°ã«0ãæžã蟌ãŸããã¡ã¢ãªã解æŸã§ããªããªããŸãã ãã®ãšã©ãŒãã¿ãŒã³ã«ã€ããŠè©³ãã説æããŸãã å€ãã®äººã¯reallocïŒïŒã誀ã£ãŠèããŠäœ¿çšããŸããã
人çºçãªã³ãŒãäŸãèããŠã¿ãŸãããïŒ
char *p = (char *)malloc(10); .... p = (char *)realloc(p, 10000);
ã¡ã¢ãªãå²ãåœãŠãããšãã§ããªãå Žåããpãå€æ°ã¯ãç ŽæãããŸãã çŸåšããã€ã³ã¿ããpãã«ä¿åãããŠããã¡ã¢ãªã解æŸããæ¹æ³ã¯ãããŸããã
ãã®åœ¢åŒã§ã¯ããšã©ãŒã¯æããã§ãã ãããå®éã«ã¯ããã®ã³ãŒãã¯éåžžã«äžè¬çã§ãã ã¢ãã©ã€ã¶ãŒã¯ããã®ãããã¯ã«é¢ããŠããã«8ã€ã®èŠåãçæããŸãããããããæ€èšããŠãæå³ããããŸããã ãšã«ãããLibreOfficeã¯ã¡ã¢ãªã¯åžžã«å²ãåœãŠããããšä¿¡ããŠããŸãã
è«çãšã©ãŒ
æ¡ä»¶ã§å€ãã®é¢çœãééãã«ééããŸããã çç±ã¯ãæããã«ãäžæ³šæãã¿ã€ããã¹ãèšèªã®ç¥èäžè¶³ã§ãã
void ScPivotLayoutTreeListData::PushDataFieldNames(....) { .... ScDPLabelData* pLabelData = mpParent->GetLabelData(nColumn); if (pLabelData == NULL && pLabelData->maName.isEmpty()) continue; .... }
PVS-StudioèŠåïŒ V522ãã«ãã€ã³ã¿ãŒ 'pLabelData'ã®éåç §ãè¡ãããå ŽåããããŸãã è«çæ¡ä»¶ã確èªããŠãã ããã pivotlayouttreelistdata.cxx 157
æ¡ä»¶ã®è«çãšã©ãŒã ãã€ã³ã¿ãŒããŒãã®å Žåããããéåç §ããŸãã ç§ãç解ããŠããããã«ãæŒç®å||ã¯ããã§äœ¿çšãããã¹ãã§ããã
åæ§ã®ãšã©ãŒïŒ
void grabFocusFromLimitBox( OQueryController& _rController ) { .... vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if( pWindow || pWindow->HasChildPathFocus() ) { pWindow->GrabFocusToDocument(); } .... }
PVS-StudioèŠåïŒV522ãã«ãã€ã³ã¿ãŒãpWindowãã®éåç §ãè¡ãããå ŽåããããŸãã è«çæ¡ä»¶ã確èªããŠãã ããã querycontroller.cxx 293
ããã§ã¯ãå察ã«ãã||ãã®ä»£ããã« ã&&ããšæžãå¿ èŠããããŸãã
å°ãè€éãªæ¡ä»¶ïŒ
enum SbxDataType { SbxEMPTY = 0, SbxNULL = 1, .... }; void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache) { .... if( (pSymDef->GetType() != SbxEMPTY) || (pSymDef->GetType() != SbxNULL) ) .... }
PVS-StudioèŠåïŒ V547åŒã¯åžžã«çã§ãã ããã§ã¯ãããããã&&ãæŒç®åã䜿çšããå¿ èŠããããŸãã sbxmod.cxx 1777
ç°¡åã«ããããã«ãåŒãæžãçŽããŸãã
if (type != 0 || type != 1)
æ¡ä»¶ã¯åžžã«çã§ãã
åæ§ã®ãšã©ãŒã2ã€ãããŸãïŒ
- V547åŒã¯åžžã«çã§ãã ããã§ã¯ãããããã&&ãæŒç®åã䜿çšããå¿ èŠããããŸãã sbxmod.cxx 1785
- V547åŒã¯åžžã«åœã§ãã ãããã '||' ããã§æŒç®åã䜿çšããå¿ èŠããããŸãã xmlstylesexporthelper.cxx 223
æ¡ä»¶ãåé·ãª2ã€ã®å ŽæãæºãããŸããã ãããã¯ãšã©ãŒã ãšæããŸãïŒ
sal_uInt16 ScRange::ParseCols(....) { .... const sal_Unicode* p = rStr.getStr(); .... case formula::FormulaGrammar::CONV_XL_R1C1: if ((p[0] == 'C' || p[0] != 'c') && NULL != (p = lcl_r1c1_get_col( p, rDetails, &aStart, &ignored ))) { .... }
PVS-StudioèŠåïŒV590 'p [0] ==' C '||ã®æ€æ»ãæ€èšããŠãã ãã p [0]ïŒ= 'c' 'åŒã è¡šçŸãéå°ã§ãããã誀æ€ãå«ãŸããŠããŸãã address.cxx 1593
æ¡ä»¶ïŒp [0] == 'C' || p [0]ïŒ= 'C'ïŒã¯ãïŒp [0]ïŒ= 'C'ïŒã«çž®å°ã§ããŸãã ããã¯ééãã§ãããæ¡ä»¶ã¯æ¬¡ã®ããã«ãªã£ãŠããã¯ãã§ãïŒp [0] == 'C' || p [0] == 'c'ïŒã
以äžã®åããã¡ã€ã«ã«åããšã©ãŒããããŸãã
- V590 'p [0] ==' R '||ã®æ€æ»ãæ€èšãã p [0]ïŒ= 'r' 'åŒã è¡šçŸãéå°ã§ãããã誀æ€ãå«ãŸããŠããŸãã address.cxx 1652
ãããããããžãã¯ã®ãšã©ãŒã«ã¯ããã€ã³ã¿ãŒãæåã«éæ¥åç §ããããŒããšçãããã©ããã ãããã§ãã¯ãããç¶æ³ãå«ãŸããŸãã ããã¯ããã¹ãŠã®ããã°ã©ã ã§éåžžã«ããããééãã§ãã éåžžãããã¯ã³ãŒãã®ãªãã¡ã¯ã¿ãªã³ã°ã®ããã»ã¹ã«ãããäžæ³šæãåå ã§çºçããŸãã
å žåçãªäŸïŒ
IMPL_LINK(....) { .... SystemWindow *pSysWin = pWindow->GetSystemWindow(); MenuBar *pMBar = pSysWin->GetMenuBar(); if ( pSysWin && pMBar ) { AddMenuBarIcon( pSysWin, true ); } .... }
PVS-StudioèŠåïŒV595 nullptrã«å¯ŸããŠæ€èšŒãããåã«ããpSysWinããã€ã³ã¿ãŒã䜿çšãããŸããã è¡ã確èªïŒ738ã739ãupdatecheckui.cxx 738
ãã€ã³ã¿ãpSysWinãã¯ãåŒãpSysWin-> GetMenuBarïŒïŒãã§éåç §ãããŸãã 次ã«ããŒããšçãããã©ããããã§ãã¯ãããŸãã
LibreOfficeã®äœæè ã¯ããããã®å ŽæLibreOffice-V595.txtã«ã泚æãæãããšããå§ãããŸãã
ãããŠæåŸã«ãä»åã¯ãã£ãšæ··ä¹±ããç¶æ³ã§ãã ç²ããŠããå Žåã¯ããã®å Žæãã¹ãããã§ããŸãã éåžžã®åæãæ€èšããŠãã ããã
enum BRC_Sides { WW8_TOP = 0, WW8_LEFT = 1, WW8_BOT = 2, WW8_RIGHT = 3, WW8_BETW = 4 };
ååä»ãå®æ°ã¯2ã®çŽ¯ä¹ã§ã¯ãªãããšã«æ³šæããŠãã ããã ãããã¯åãªãæ°åã§ãã 0ãå«ãã
ãããŠã2ã€ã®çŽ¯ä¹ãè¡šããã®ããã«ããããã®å®æ°ã䜿çšããŸãã 圌ãã¯ãã¹ã¯ã«ãã£ãŠåã ã®ããããéžæããŠãã§ãã¯ããããšããŸãïŒ
void SwWW8ImplReader::Read_Border(....) { .... if ((nBorder & WW8_LEFT)==WW8_LEFT) aBox.SetDistance( (sal_uInt16)aInnerDist.Left(), BOX_LINE_LEFT ); if ((nBorder & WW8_TOP)==WW8_TOP) aBox.SetDistance( (sal_uInt16)aInnerDist.Top(), BOX_LINE_TOP ); if ((nBorder & WW8_RIGHT)==WW8_RIGHT) aBox.SetDistance( (sal_uInt16)aInnerDist.Right(), BOX_LINE_RIGHT ); if ((nBorder & WW8_BOT)==WW8_BOT) aBox.SetDistance( (sal_uInt16)aInnerDist.Bottom(), BOX_LINE_BOTTOM ); .... }
PVS-StudioèŠåïŒ V616å€ã0ã®ååä»ãå®æ°ãWW8_TOPãããããæŒç®ã§äœ¿çšãããŸãã ww8par6.cxx 4742
ãããã¯ééã£ãè¡åã§ãã ããšãã°ãæ¡ä»¶ïŒïŒnBorderïŒWW8_TOPïŒ== WW8_TOPïŒã¯åžžã«trueã§ãã 説æã®ããã«ãæ°åãä»£å ¥ããŸãïŒïŒïŒnBorderïŒ0ïŒ== 0ïŒã
nBorderå€æ°ã«3ã«çããWW8_RIGHTãå«ãŸããŠããå ŽåãWW8_LEFTã®ãã§ãã¯ã倱æããŸãã眮æïŒïŒ3ïŒ1ïŒ== 1ïŒã WW8_RIGHTãWW8_LEFTãšããŠåãå ¥ããŸãã
ã¯ããŒãŒããã®äžã®ã¹ã±ã«ãã³
ã¢ãã©ã€ã¶ã¯ãã³ãŒãå ã®ç°åžžãªå Žæãæã æ€åºããŸãã ãããã¯ééãã§ã¯ãªããunningãªã¢ã€ãã¢ã§ãã ãããã«è§Šããã®ã¯æå³ããããŸããããèŠãã®ã¯é¢çœããããããŸããã 以äžã«ãã¢ãã©ã€ã¶ãŒãfreeïŒïŒé¢æ°ãžã®åŒæ°ã奜ãŸãªãã£ãå Žåã®äŸã瀺ããŸãã
/* This operator is supposed to be unimplemented, but that now leads * to compilation and/or linking errors with MSVC2008. (Don't know * about MSVC2010.) As it can be left unimplemented just fine with * gcc, presumably it is never called. So do implement it then to * avoid the compilation and/or linking errors, but make it crash * intentionally if called. */ void SimpleReferenceObject::operator delete[](void * /* pPtr */) { free(NULL); }
å®å šäžã®æ³šæ
ã¢ãã©ã€ã¶ãŒã¯ãããã°ã©ã ã³ãŒããå±éºã«ããå€ãã®ãã€ã³ããç¹å®ããŸããã å±éºã¯æ¬è³ªçã«å€æ§ã§ãããç§ã¯ãããã1ã€ã®ã»ã¯ã·ã§ã³ã«ãŸãšããããšã«ããŸããã
void writeError( const char* errstr ) { FILE* ferr = getErrorFile( 1 ); if ( ferr != NULL ) { fprintf( ferr, errstr ); fflush( ferr ); } }
PVS-StudioèŠåïŒ V618ãã®ãããªæ¹æ³ã§ãfprintfãé¢æ°ãåŒã³åºãã®ã¯å±éºã§ããæž¡ãããè¡ã«ã¯åœ¢åŒã®ä»æ§ãå«ãŸããŠããå¯èœæ§ãããããã§ãã å®å šãªã³ãŒãã®äŸïŒprintfïŒ "ïŒ s"ãstrïŒ; unoapploader.c 405
æååãerrstrãã«å¶åŸ¡æåãå«ãŸããŠããå Žåãäœã§ãèµ·ãããŸãã ããã°ã©ã ãã¯ã©ãã·ã¥ãããããã¡ã€ã«ã«ãŽããæžã蟌ãã ããäœãä»ã®ãã®ãçºçãããããããšããããŸãïŒ è©³çŽ° ïŒã
ãã®ããã«æžãã®ã¯æ£ããã§ãããïŒ
fprintf( ferr, "%s", errstr );
printfïŒïŒé¢æ°ã誀ã£ãŠäœ¿çšãããããã«2ã€ã®å ŽæïŒ
- climaker_app.cxx 261
- climaker_app.cxx 313
dynamic_castã®å±éºãªäœ¿çšã«ã€ããŠèª¬æããŸãã
virtual ~LazyFieldmarkDeleter() { dynamic_cast<Fieldmark&> (*m_pFieldmark.get()).ReleaseDoc(m_pDoc); }
PVS-Studioã®èŠåïŒ V509 ãdynamic_cast <TïŒ>ãæŒç®åã¯ãäŸå€ãçæããå¯èœæ§ããããããtry..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã docbm.cxx 846
ãªã³ã¯ãæäœãããšãã«ãå€æãå®è¡ã§ããªãå Žåãdynamic_castãªãã¬ãŒã¿ãŒã¯std :: bad_castäŸå€ãã¹ããŒããŸãã
ããã°ã©ã ã§äŸå€ãçºçãããšãã¹ã¿ãã¯ã®æãããã¿ãéå§ããããã®éããã¹ãã©ã¯ã¿ãåŒã³åºãããšã«ãããªããžã§ã¯ããç Žæ£ãããŸãã ã¹ã¿ãã¯ã厩å£ãããšãã«ç Žå£ããããªããžã§ã¯ãã®ãã¹ãã©ã¯ã¿ãå¥ã®äŸå€ãã¹ããŒãããã¹ãã©ã¯ã¿ããã®äŸå€ãæ®ããšãC ++ã©ã€ãã©ãªã¯terminateïŒïŒé¢æ°ãåŒã³åºããŠããã°ã©ã ãããã«ã¯ã©ãã·ã¥ãããŸãã ãããã£ãŠããã¹ãã©ã¯ã¿ã¯æ±ºããŠäŸå€ãã¹ããŒãã¹ãã§ã¯ãããŸããã ãã¹ãã©ã¯ã¿å ã§ã¹ããŒãããäŸå€ã¯ãåããã¹ãã©ã¯ã¿å ã§åŠçããå¿ èŠããããŸãã
åãçç±ã§ããã¹ãã©ã¯ã¿ã§æ°ããæŒç®åãåŒã³åºãããšã¯å±éºã§ãã ãã®æŒç®åã¯ãååãªã¡ã¢ãªããªãå Žåã«äŸå€std :: bad_allocãã¹ããŒããŸãã try-catchãããã¯ã§ã©ããããããšããå§ãããŸãã
å±éºãªã³ãŒãã®äŸïŒ
WinMtfOutput::~WinMtfOutput() { mpGDIMetaFile->AddAction( new MetaPopAction() ); .... }
PVS-StudioèŠåïŒV509äŸå€ãçæããå¯èœæ§ãããããããnewãæŒç®åã¯try..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã winmtf.cxx 852
ãã¹ãã©ã¯ã¿ã§ã®ä»ã®å±éºãªã¢ã¯ã·ã§ã³ïŒ
- V509ãdynamic_cast <TïŒ>ãæŒç®åã¯ãäŸå€ãçæããå¯èœæ§ããããããtry..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã ndtxt.cxx 4886
- V509äŸå€ãçæããå¯èœæ§ãããããããnewãæŒç®åã¯try..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã export.cxx 279
- V509äŸå€ãçæããå¯èœæ§ãããããããnewãæŒç®åã¯try..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã getfilenamewrapper.cxx 73
- V509äŸå€ãçæããå¯èœæ§ãããããããnewãæŒç®åã¯try..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã e3dsceneupdater.cxx 80
- V509äŸå€ãçæããå¯èœæ§ãããããããnewãæŒç®åã¯try..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã accmap.cxx 1683
- V509äŸå€ãçæããå¯èœæ§ãããããããnewãæŒç®åã¯try..catchãããã¯å ã«é 眮ããå¿ èŠããããŸãã ãã¹ãã©ã¯ã¿å ã§äŸå€ãçºçãããããšã¯éæ³ã§ãã frmtool.cxx 938
ãšããã§ãæŒç®ånewã«ã€ããŠè©±ããŠããã®ã§ããã®ã³ãŒãã®å±éºæ§ã«æ³šæããŸãã
extern "C" oslFileHandle SAL_CALL osl_createFileHandleFromOSHandle( HANDLE hFile, sal_uInt32 uFlags) { if ( !IsValidHandle(hFile) ) return 0; // EINVAL FileHandle_Impl * pImpl = new FileHandle_Impl(hFile); if (pImpl == 0) { // cleanup and fail (void) ::CloseHandle(hFile); return 0; // ENOMEM } .... }
PVS-StudioèŠåïŒ V668 ãnewãæŒç®åã䜿çšããŠã¡ã¢ãªãå²ãåœãŠãããããããpImplããã€ã³ã¿ãnullã«å¯ŸããŠãã¹ãããŠãæå³ããããŸããã ã¡ã¢ãªå²ãåœãŠãšã©ãŒã®å ŽåãäŸå€ãçæãããŸãã file.cxx 663
ãnewãæŒç®åã¯ãã¡ã¢ãªãå°ãªãå Žåã«äŸå€ãã¹ããŒããŸãã ãããã£ãŠããªãã¬ãŒã¿ãŒãæ»ãããã€ã³ã¿ãŒã確èªããããšã¯æå³ããããŸããã åžžã«0ã§ã¯ãããŸãããååãªã¡ã¢ãªããªãå ŽåãCloseHandleïŒïŒé¢æ°ã¯åŒã³åºãããŸããã
FileHandle_Impl * pImpl = new FileHandle_Impl(hFile); if (pImpl == 0) { // cleanup and fail (void) ::CloseHandle(hFile); return 0; // ENOMEM }
ç§ã¯ééã£ãŠããå¯èœæ§ããããŸããLibreOfficeãããžã§ã¯ãã«ã€ããŠç¥ããŸãããããããéçºè ã¯ããnewãæŒç®åãäŸå€ãã¹ããŒããã«nullptrãè¿ãç¹å¥ãªããŒãžã§ã³ã®ã©ã€ãã©ãªã䜿çšããŸãããã®å Žåãçªå·V668ã®èŠåãç¡èŠããŠãã ãããå¹²æžããªãããã«ãªãã«ããããšãã§ããŸãã
newãªãã¬ãŒã¿ãŒãäŸå€ãã¹ããŒããå Žåã次ã®126ã¡ãã»ãŒãžãåç §ããããšããå§ãããŸãïŒLibreOffice-V668.txtã
次ã®å±éºã¯ãDllMainé¢æ°ã®1ã€ã®å®è£ ã«ãããŸãã
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { .... CreateThread( NULL, 0, ParentMonitorThreadProc, (LPVOID)dwParentProcessId, 0, &dwThreadId ); .... }
PVS-StudioèŠåïŒV718ãDllMainãé¢æ°ãããCreateThreadãé¢æ°ãåŒã³åºããªãã§ãã ããã dllentry.c 308
DllMainïŒïŒé¢æ°å ã§å€ãã®é¢æ°ãåŒã³åºãããšã¯ã§ããŸãããããã¯ãã¢ããªã±ãŒã·ã§ã³ã®ã¯ã©ãã·ã¥ããã®ä»ã®ãšã©ãŒãåŒãèµ·ããå¯èœæ§ãããããã§ãã CreateThreadïŒïŒã¯ãã®ãããªé¢æ°ãæããŸãã
DllMainã®ç¶æ³ã¯ãMSDNã®èšäºïŒDynamic-Link Library Best Practicesã§è©³ãã説æãããŠããŸãã
ãã®ã³ãŒãã¯æ©èœããå¯èœæ§ããããŸãããå±éºã§ããããã€ã倱æããå¯èœæ§ããããŸãã
wcsncpyïŒïŒé¢æ°ããããã¡ãªãŒããŒãããŒãåŒãèµ·ããå¯èœæ§ãããç¶æ³ããããŸããã
typedef struct { .... WCHAR wszTitle[MAX_COLUMN_NAME_LEN]; WCHAR wszDescription[MAX_COLUMN_DESC_LEN]; } SHCOLUMNINFO, *LPSHCOLUMNINFO; HRESULT STDMETHODCALLTYPE CColumnInfo::GetColumnInfo( DWORD dwIndex, SHCOLUMNINFO *psci) { .... wcsncpy(psci->wszTitle, ColumnInfoTable[dwIndex].wszTitle, (sizeof(psci->wszTitle) - 1)); return S_OK; }
PVS-StudioèŠåïŒV512ãwcsncpyãé¢æ°ãåŒã³åºããšããããã¡ãŒãpsci-> wszTitleãããªãŒããŒãããŒããŸããcolumninfo.cxx 129
åŒïŒsizeofïŒpsci-> wszTitleïŒ-1ïŒãæ£ãããããŸããã1æåã®ãµã€ãºã§é€ç®ããã®ãå¿ããïŒ
(sizeof(psci->wszTitle) / sizeof(psci->wszTitle[0]) - 1)
ãã®ã»ã¯ã·ã§ã³ã§ã«ããŒããæåŸã®ã¿ã€ãã®ãšã©ãŒã¯ãmemsetïŒïŒé¢æ°ã®åŒã³åºããå£ããŠããããšã§ãã äŸïŒ
static void __rtl_digest_updateMD2 (DigestContextMD2 *ctx) { .... sal_uInt32 state[48]; .... memset (state, 0, 48 * sizeof(sal_uInt32)); }
PVS-StudioèŠåïŒV597ã³ã³ãã€ã©ãŒã¯ããç¶æ ããããã¡ãŒã®ãã©ãã·ã¥ã«äœ¿çšããããmemsetãé¢æ°åŒã³åºããåé€ã§ããŸããã RtlSecureZeroMemoryïŒïŒé¢æ°ã䜿çšããŠããã©ã€ããŒãããŒã¿ãæ¶å»ããå¿ èŠããããŸããdigest.cxx 337
ãã®çš®ã®ãšã©ãŒã«ã€ããŠäœåºŠãæžããŠããŸãããããã£ãŠãç§ã¯ãããã»ãã®æ°èªã§èª¬æããææ¡ããããªã³ã¯ãã¯ãªãã¯ããŠè©³çŽ°ãèŠã€ããããšãã§ããŸãã
ã³ã³ãã€ã©ãŒã¯ãmemsetïŒïŒé¢æ°ã®åŒã³åºããåé€ããåŸã«ããŒãåãããã¡ã¢ãªãŒã䜿çšãããªãå Žåããã®åŒã³åºããåé€ããæš©å©ãæã£ãŠããŸãããããããã§èµ·ããããšã§ãããã®çµæãäžéšã®ãã©ã€ããŒãããŒã¿ãã¡ã¢ãªã«æ®ããŸãã
詳现ïŒ
- V597 ã³ã³ãã€ã©ã¯ããFooããããã¡ããã©ãã·ã¥ããããã«äœ¿çšããããmemsetãé¢æ°åŒã³åºããåé€ã§ããŸãã
- ã¡ã¢ãªã®äžæžã-ãªãã§ããïŒ
- ãŒããå¿ããŠããŸã£ã-ã¡ã¢ãªã®èŠåãCããŒãã«ã
ãã®ä»
Guess::Guess() { language_str = DEFAULT_LANGUAGE; country_str = DEFAULT_COUNTRY; encoding_str = DEFAULT_ENCODING; } Guess::Guess(const char * guess_str) { Guess(); .... }
PVS-StudioèŠåïŒV603ãªããžã§ã¯ãã¯äœæãããŸãããã䜿çšãããŠããŸãããã³ã³ã¹ãã©ã¯ã¿ãŒãåŒã³åºãå Žåã¯ããthis-> Guess :: GuessïŒ....ïŒãã䜿çšããå¿ èŠããããŸããguess.cxx 56
ãã®ã³ãŒããæžããããã°ã©ããŒã¯C ++ãååã«ç解ããŠããŸããã圌ã¯ãããã³ã³ã¹ãã©ã¯ã¿ãŒãå¥ã®ã³ã³ã¹ãã©ã¯ã¿ãŒããåŒã³åºããããšèããŠããŸãããããããå®éã«ã¯ã圌ã¯äžæçãªååã®ãªããªããžã§ã¯ããäœæããŸããããšã©ãŒã®ãããã¯ã©ã¹ã®äžéšã®ãã£ãŒã«ãã¯åæåãããŠããªããŸãŸã§ãã 詳现
å¥ã®å€±æããã³ã³ã¹ãã©ã¯ã¿ãŒïŒcamera3d.cxx 46
sal_uInt32 readIdent(....) { size_t nItems = rStrings.size(); const sal_Char** pStrings = new const sal_Char*[ nItems+1 ]; .... delete pStrings; return nRet; }
PVS-Studio èŠåïŒV611ã¡ã¢ãªã¯ãnew T []ãæŒç®åã䜿çšããŠå²ãåœãŠãããŸãããããdeleteãæŒç®åã䜿çšããŠè§£æŸãããŸããããã®ã³ãŒãã調ã¹ãããšãæ€èšããŠãã ããããdelete [] pStrings;ãã䜿çšããããšããå§ãããŸããprofile.hxx 103
æ£ããã§ãããïŒdelete [] pStrings;ã
äžé©åãªã¡ã¢ãªå²ãåœãŠè§£é€ã«é¢ããå¥ã®èŠåïŒ
- V611ã¡ã¢ãªãŒã¯ãnew T []ãæŒç®åã䜿çšããŠå²ãåœãŠãããŸãããããdeleteãæŒç®åã䜿çšããŠè§£æŸãããŸããã ãã®ã³ãŒãã調ã¹ãããšãæ€èšããŠãã ããããdelete [] pStrings;ãã䜿çšããããšããå§ãããŸããprofile.hxx 134
static const int kConventionShift = 16; static const int kFlagMask = ~((~int(0)) << kConventionShift);
èŠåPVS-StudioïŒV610æªå®çŸ©ã®åäœãã·ããæŒç®åã<<ãã確èªããŠãã ãããå·Šã®ãªãã©ã³ã 'ïŒãintïŒ0ïŒïŒ'ã¯è² ã§ããgrammar.hxx 56
è² ã®å€ã®ã·ããã«ãããæªå®çŸ©ã®åäœãçºçããŸãïŒè©³çŽ°ïŒã
sal_Int32 GetMRest() const {return m_nRest;} OUString LwpBulletStyleMgr::RegisterBulletStyle(....) { .... if (pIndent->GetMRest() > 0.001) .... }
PVS-StudioèŠåïŒV674ãdoubleãã¿ã€ãã®ã0.001ããªãã©ã«ã¯ããlongãã¿ã€ãã®å€ãšæ¯èŒãããŸãã ãpIndent-> GetMRestïŒïŒ> 0.001ãåŒã調ã¹ãããšãæ€èšããŠãã ããã lwpbulletstylemgr.cxx 177
ããã§äœãããããããæŽæ°å€ã0.001ãšæ¯èŒããããšã¯æå³ããããŸããã
æ»ãåãšã®äžå¿«ãªæ··ä¹±ïŒ
BOOL SHGetSpecialFolderPath( HWND hwndOwner, _Out_ LPTSTR lpszPath, _In_ int csidl, _In_ BOOL fCreate ); #define FAILED(hr) (((HRESULT)(hr)) < 0) OUString UpdateCheckConfig::getDesktopDirectory() { .... if( ! FAILED( SHGetSpecialFolderPathW( .... ) ) ) .... }
PVS-Studioã®èŠåïŒV716çãããã¿ã€ãã®å€æïŒBOOL- > HRESULTãupdatecheckconfig.cxx 193
ããã°ã©ããŒã¯ãSHGetSpecialFolderPathïŒïŒãHRESULTåãè¿ãããšã決å®ããŸãããããããå®éã«ã¯ãé¢æ°ã¯BOOLãè¿ããŸããã³ãŒããä¿®æ£ããã«ã¯ãæ¡ä»¶ããFAILEDãã¯ããåé€ããŸãã
å¥ã®ãã®ãããªãšã©ãŒïŒupdatecheckconfig.cxx 222
ãããŠãããã§ã¯ãå察ã«ãFAILEDãã¯ãããããŸããããããã£ãŠãã¿ã€ãHRESULTã®ã¹ããŒã¿ã¹ã確èªããããšã¯ã§ããŸããã
bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) { .... HRESULT nRC = ScriptItemize(....); if( !nRC ) // break loop when everything is correctly itemized break; .... }
PVS-StudioèŠåïŒV545ãã®ãããªãifãæŒç®åã®æ¡ä»¶åŒã¯ãHRESULTåã®å€ãnRCãã«å¯ŸããŠæ£ãããããŸããã代ããã«SUCCEEDEDãŸãã¯FAILEDãã¯ãã䜿çšããå¿ èŠããããŸããwinlayout.cxx 1115
ããã§ã¯ãã³ã³ããã»ãã³ãã³ã«çœ®ãæããå¿ èŠããããšæããŸãã
void Reader::ClearTemplate() { if( pTemplate ) { if( 0 == pTemplate->release() ) delete pTemplate, pTemplate = 0; } }
PVS-StudioèŠåïŒV626ãã¹ããªã³ãã®ãã§ãã¯ãæ€èšããŠãã ãããããããã;ãã«çœ®ãæããå¿ èŠãããå ŽåããããŸããshellio.cxx 549
é¢çœããªãäºçŽ°ãªããšïŒ
void TabBar::ImplInit( WinBits nWinStyle ) { .... mbMirrored = false; mbMirrored = false; .... }
PVS-StudioèŠåïŒV519ãmbMirroredãå€æ°ã«ã¯ãé£ç¶ããŠ2åå€ãå²ãåœãŠãããŸãã ããããããã¯ééãã§ããè¡ããã§ãã¯ããŠãã ããïŒ415ã416
ãããããããã¯ééãã§ããè¡ã確èªããŠãã ããïŒ4561ã4562ãoutput2.cxx 4562
æååã®é·ãã瀺ãããžãã¯å®æ°ãæ£ãããããŸããïŒ
static bool CallRsc2(....) { .... if( !rsc_strnicmp( ...., "-fp=", 4 ) || !rsc_strnicmp( ...., "-fo=", 4 ) || !rsc_strnicmp( ...., "-presponse", 9 ) || <<<<---- !rsc_strnicmp( ...., "-rc", 3 ) || !rsc_stricmp( ...., "-+" ) || !rsc_stricmp( ...., "-br" ) || !rsc_stricmp( ...., "-bz" ) || !rsc_stricmp( ...., "-r" ) || ( '-' != *.... ) ) .... }
PVS-StudioèŠåïŒV666é¢æ°ãrsc_strnicmpãã®3çªç®ã®åŒæ°ã調ã¹ãããšãæ€èšããŠãã ãããå€ãã2çªç®ã®åŒæ°ã§æž¡ãããæååã®é·ããšäžèŽããªãå¯èœæ§ããããŸããstart.cxx 179
æååã-presponseãã®é·ãã¯9æåã§ã¯ãªã10æåã§ãã
ã«ãŒãå ã®å¥åŠãªããã¬ãŒã¯ãïŒ
OUString getExtensionFolder(....) { .... while (xResultSet->next()) { title = Reference<sdbc::XRow>( xResultSet, UNO_QUERY_THROW )->getString(1 /* Title */ ) ; break; } return title; }
PVS-StudioèŠåïŒV612ã«ãŒãå ã®ç¡æ¡ä»¶ã®ããã¬ãŒã¯ããdp_manager.cxx 100
ããã«3ã€ã®å¥åŠãªãµã€ã¯ã«ïŒ
- V612ã«ãŒãå ã®ç¡æ¡ä»¶ã®ããã¬ãŒã¯ããsvdfppt.cxx 3260
- V612ã«ãŒãå ã®ç¡æ¡ä»¶ã®ããã¬ãŒã¯ããsvdfppt.cxx 3311
- V612ã«ãŒãå ã®ç¡æ¡ä»¶ã®ããã¬ãŒã¯ããpersonalization.cxx 454
å¯èœæ§ã®äœããã«ãã€ã³ã¿ãŒã®éåç §ïŒ
BSTR PromptNew(long hWnd) { .... ADOConnection* piTmpConnection = NULL; ::CoInitialize( NULL ); hr = CoCreateInstance( CLSID_DataLinks, NULL, CLSCTX_INPROC_SERVER, IID_IDataSourceLocator, (void**)&dlPrompt ); if( FAILED( hr ) ) { piTmpConnection->Release(); dlPrompt->Release( ); return connstr; } .... }
PVS-StudioèŠåïŒV522ãã«ãã€ã³ã¿ãŒãpiTmpConnectionãã®éåç §ãè¡ãããå ŽåããããŸããadodatalinks.cxx 84
CoCreateInstanceïŒïŒé¢æ°ãçªç¶ãšã©ãŒã¹ããŒã¿ã¹ãè¿ãå Žåããã€ã³ã¿ã¯NULLã®ãpiTmpConnectionãã§éåç §ãããŸãã
ãã¯ãæé©å
éçã¢ãã©ã€ã¶ãŒã¯ããããã¡ã€ãªã³ã°ããŒã«ã®ä»£ããã«ã¯ãªããŸããããããã¡ã€ã©ãŒã®ã¿ããããã°ã©ã ãæé©åãã䟡å€ãããå Žæã瀺ãããšãã§ããŸãã
ããã§ããéçã¢ãã©ã€ã¶ãŒã¯ãã³ãŒãå ã®ç°¡åã«æ¹åã§ããå Žæã衚瀺ã§ããŸããããããããã°ã©ã ãé«éã§å®è¡ããå¿ èŠã¯ãããŸãããããããããã¯ç¢ºãã«æªåããŸããããããããããã¯åªããã³ãŒãã£ã³ã°ã¹ã¿ã€ã«ã«é¢ãããã®ã§ãã
PVS-Studioããã€ã¯ãæé©åã«é¢ããŠæäŸããæšå¥šäºé ãèŠãŠã¿ãŸãããã
åç §ã«ãããªããžã§ã¯ãã®åãæž¡ã
é¢æ°ã«æž¡ããããªããžã§ã¯ããå€æŽãããªãå Žåã審çŸçã«ã¯å€ã§ã¯ãªãåç §ã«ãã£ãŠæž¡ãããŸãããã¡ãããããã¯ãã¹ãŠã®ãªããžã§ã¯ãã«é©çšãããããã§ã¯ãããŸããããã ããããšãã°æååãåŠçããŠããå Žåãã¡ã¢ãªãå²ãåœãŠãŠæååã®å 容ãç¡é§ã«ã³ããŒããŠãæå³ããããŸããã
äŸïŒ
string getexe(string exename, bool maybeempty) { char* cmdbuf; size_t cmdlen; _dupenv_s(&cmdbuf, &cmdlen, exename.c_str()); if(!cmdbuf) { if (maybeempty) { return string(); } cout << "Error " << exename << " not defined. " "Did you forget to source the environment?" << endl; exit(1); } string command(cmdbuf); free(cmdbuf); return command; }
ãªããžã§ã¯ããexenameãã¯èªã¿åãå°çšã§ãããããã£ãŠãã¢ãã©ã€ã¶ãŒã¯æ¬¡ãå ±åããŸããV813ããã©ãŒãã³ã¹ã®äœäžããexenameãåŒæ°ã¯ãããããå®æ°åç §ãšããŠã¬ã³ããªã³ã°ãããå¿ èŠããããŸããwrapper.cxx 18
é¢æ°å®£èšã¯æ¬¡ã®ããã«å€æŽã§ããŸãã
string getexe(const string &exename, bool maybeempty)
éåžžãå®æ°åç §ãä»ããŠè€éãªãªããžã§ã¯ããæž¡ãæ¹ãå¹ççã§ããããã¯ãªããã³ã°ãåé¡ãåé¿ããŸããæ¬è³ªãååã«ç解ããŠããªã人ã®ããã«ãç§ã¯æ¬ããã®ã«ãŒã«20ã䟡å€ã«ããäŒéã«ããconstãžã®åç §ã«ããäŒéã奜ãããåç §ããããšãææ¡ã
ãŸããããã°ã©ã ã®æ§é ãšã³ãŒããæ¹åãã55ã®ç¢ºå®ãªæ¹æ³â-M .: DMK Pressã2006.-300 ppããIllãISBN 5-94074-304-8
å¥ã®é¢é£ãã蚺æã¯V801ã§ããã¢ãã©ã€ã¶ãŒã¯åèšã§465ã®èŠåãçºè¡ããŸãããã圌ã®æèŠã§ã¯ãåç §ã«ãã£ãŠãªããžã§ã¯ãã転éããããšã¯å¯èœã§ãïŒLibreOffice-V801-V813.txtã
ãã¬ãã£ãã¯ã¹ã€ã³ã¯ãªã¡ã³ãã䜿çšãã
ã€ãã¬ãŒã¿ã®å Žåãæ¥é èŸã®å¢åæäœã¯ãããã«é«éã§ããããã«ã€ããŠã®è©³çŽ°ã¯ãã
Meyers S. C ++ã®æãå¹ççãªäœ¿çšãã®æ¬ã®ãã«ãŒã«6.ã€ã³ã¯ãªã¡ã³ãæŒç®åãšãã¯ãªã¡ã³ãæŒç®åã®ãã¬ãã£ãã¯ã¹åœ¢åŒãåºå¥ããããåç §ããŠãã ãããããã°ã©ã ãšãããžã§ã¯ããæ¹åããããã®35ã®æ°ããæšå¥šäºé ïŒPerãè±èªãã-M .: DMK Pressã2000 .-- 304 pãïŒç æ° ïŒãããã°ã©ããŒåããã·ãªãŒãºïŒãISBN 5-94074-033-2ãBBK 32.973.26-018.1ã
æšå¥šäºé ã¯ãšãŠã€ããªãããã«æãããå®éã«ã¯ãA ++ããšã++ Aãã®éã«éãã¯ãããŸããããã®åé¡ãç 究ããå®éšãè¡ã£ããšããããã®æšå¥šäºé ãé©çšããå¿ èŠããããšèããŠããŸãïŒè©³çŽ°ïŒã
ã³ãŒãäŸïŒ
typename InterfaceMap::iterator find(const key &rKey) const { typename InterfaceMap::iterator iter = m_pMap->begin(); typename InterfaceMap::iterator end = m_pMap->end(); while( iter != end ) { equalImpl equal; if( equal( iter->first, rKey ) ) break; iter++; } return iter; }
èŠåPVS_StudioïŒV803ããã©ãŒãã³ã¹ã®äœäžããiterããã€ãã¬ãŒã¿ã®å Žåãæ¥é èŸåœ¢åŒã®ã€ã³ã¯ãªã¡ã³ãã䜿çšããæ¹ãå¹æçã§ããã€ãã¬ãŒã¿++ã++ã€ãã¬ãŒã¿ã«çœ®ãæããŸããinterfacecontainer.h 405
ãiter ++ããšããè¡šçŸã¯ã++ iterãã«çœ®ãæããå¿ èŠããããŸããéçºè ãããã«æéãè²»ããããšãåççã§ãããšèããŠãããã©ããã¯ããããŸãããäœãä¿®æ£ãããã決å®ãããšãåŸçœ®å¢åãæ¥é èŸå¢åLibreOffice-V803.txtã§çœ®ãæããããšãã§ããå Žæãããã«257åãããŸãã
æååã空ã§ããããšã確èªããŠãã ãã
æååã空ã§ããããšã確èªããã«ã¯ããã®é·ããèšç®ããå¿ èŠã¯ãããŸãããéå¹ççãªã³ãŒãã®äŸïŒ
BOOL GetMsiProp(....) { .... char* buff = reinterpret_cast<char*>( malloc( nbytes ) ); .... return ( strlen(buff) > 0 ); }
èŠåPVS-StudioïŒV805ããã©ãŒãã³ã¹ã®äœäžã'strlenïŒstrïŒ> 0'ã³ã³ã¹ãã©ã¯ãã䜿çšããŠç©ºã®æååãèå¥ããããšã¯éå¹ççã§ããããå¹ççãªæ¹æ³ã¯ããã§ãã¯ããããšã§ãïŒstr [0]ïŒ= '\ 0'ãsellang.cxx 49
éå¹çæ§ã¯ãçµç«¯ã®ãŒãã«ééãããŸã§æååå ã®ãã¹ãŠã®æåãå埩åŠçããå¿ èŠãããããšã§ãããã ãã1ãã€ãã®ã¿ããã§ãã¯ããã ãã§ååã§ãã
return buff[0] != '\0';
ãã®ã³ãŒãã¯ããŸãçŸãããããŸããã®ã§ãç¹å¥ãªæ©èœãæã€æ¹ãè¯ãã§ãããïŒ
inline bool IsEmptyStr(const char *s) { return s == nullptr || s[0] == '\0'; }
ããã§ã¯ããŒããžã®ãã€ã³ã¿ãŒã®ç䟡æ§ã«é¢ããè¿œå ã®ãã§ãã¯ããããŸãããç§ã¯ãããããŸã奜ãã§ã¯ãªãã®ã§ãä»ã®ãªãã·ã§ã³ã«ã€ããŠèããããšãã§ããŸããããã§ãããã®é¢æ°ã¯strlenïŒïŒãããéãåäœããŸãã
ãã®ä»ã®ç¡å¹ãªãã§ãã¯ïŒLibreOffice-V805.txtã
ãã®ä»
èå³æ·±ããšæãããã¢ãã©ã€ã¶ãŒã®èŠåãããã«ããã€ããããŸãïŒLibreOffice-V804_V811.txtã
誀æ€ç¥ã®æ°
èšäºã®äžã§ãç§ã¯240ã®èŠåã«ã€ããŠèšåããŸãããåèšã§ãã¢ãã©ã€ã¶ãŒã¯çŽ1,500ã®äžè¬èŠåïŒGAïŒã¬ãã«1ããã³2ã®ã¢ã©ãŒããçæããŸãããããã¯ãã¢ãã©ã€ã¶ãŒãå€ãã®åœéœæ§ãçæããããšãæå³ããŸããïŒããã»ãšãã©ã®èŠåã¯å®å šã«ãã®ã±ãŒã¹ã«åœãŠã¯ãŸããŸãããèšäºã§ãããã«ã€ããŠèª¬æããæå³ã¯ãããŸããã
æã ããŠãŒã¶ãŒãããPVS-Studioã¢ãã©ã€ã¶ãŒã¯èª€æ€ç¥ãã»ãšãã©çºçããããéåžžã«äŸ¿å©ã§ãããšããè¯å®çãªãã£ãŒãããã¯ãåãåããŸãããŸãã誀æ€ç¥ã¯ã»ãšãã©ãªããšèããŠããŸããããããã©ã®ããã«ïŒãã®èšäºã§ã¯ãæçš¿ã®16ïŒ ãã説æããŠããŸãããæ®ãã¯äœã§ããïŒèª€æ€ç¥ã§ããïŒ
ãã¡ããã誀æ€ç¥ããããŸããããããéããããšã¯ã§ããŸãããããããæããå€ãã®ã¡ã«ããºã ããããŸãããã ããã»ãšãã©ã®èŠåã¯ãšã©ãŒãæ€åºããŠããŸããããæªèãæŸã€ã³ãŒãã瀺ããŠããŸããäŸã§èª¬æããããšæããŸãã
ã¢ãã©ã€ã¶ãŒã¯ãV690ã«å¯ŸããŠ206åã®èŠåãçºè¡ããŸãããã³ããŒã³ã³ã¹ãã©ã¯ã¿ã¯ã¯ã©ã¹ã«å®è£ ãããŠããŸãããä»£å ¥æŒç®åã¯å®è£ ãããŠããŸããããããã®ã¯ã©ã¹ã®1ã€ã次ã«ç€ºããŸãã
class RegistryTypeReader { public: .... inline RegistryTypeReader(const RegistryTypeReader& toCopy); .... }; inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader& toCopy) : m_pApi(toCopy.m_pApi) , m_hImpl(toCopy.m_hImpl) { m_pApi->acquire(m_hImpl); }
é«ã確çã§ééãã¯ãããŸãããã»ãšãã©ã®å ŽåãæŒç®å=ã¯206ã¯ã©ã¹ãã¹ãŠã§äœ¿çšãããŠããããã§ã¯ãããŸããã䜿çšããããã©ããªããŸããïŒ
ããã§ã¯ãããã°ã©ããŒãéžæããå¿ èŠããããŸãã
ã³ãŒããå±éºã§ãããšèããå Žåãå²ãåœãŠæŒç®åãå®è£ ããããçŠæ¢ããå¿ èŠããããŸãã圌ã®æèŠã§å±éºããªããã°ã圌ã¯V690蚺æããªãã«ããããšãã§ããçãããå Žæã®ãªã¹ãã¯ããã«206èŠåã倱ããŸãã
å¥ã®äŸã ãã®èšäºã®ååã§ã次ã®çãããã¹ãããããèšåãããŸããã
if( pInit ) AddMap( pInit ); if( pInit ) AddMap( pInit2 );
V581蚺æã䜿çšããŠæ€åºãããŸãããããããæ£çŽã«èšããšãç§ã¯V581ã®èŠåãéåžžã«è¡šé¢çã«èŠãŠãããäœããèŠéããŠããå¯èœæ§ããããŸããå®éã«ã¯ãããã«70ãããŸãããããŠãã¢ãã©ã€ã¶ãŒã®ããã§ã¯ãããŸããããã®ããã«æžãçç±ã圌ã¯ã©ã®ããã«ããŠç¥ã£ãã®ã§ããïŒ
static bool lcl_parseDate(....) { bool bSuccess = true; .... if (bSuccess) { ++nPos; } if (bSuccess) { bSuccess = readDateTimeComponent(string, nPos, nDay, 2, true); .... }
2åãbSuccessãããã§ãã¯ãããŸããçªç¶ã2åç®ã«å¥ã®å€æ°ããã§ãã¯ããå¿ èŠããããŸããïŒ
ãã®ãããª70åã®èŠåãã©ããããã¯ãããã°ã©ããŒãå床決å®ããå¿ èŠããããŸããããã€ãã®è«çãããã¯ãåé¢ããããã«è€æ°ã®åäžã®ãã§ãã¯ãè¡ãã®ã奜ããªå Žåãã¢ãã©ã€ã¶ãŒã¯ç¢ºãã«æ£ãããããŸããã V581蚺æããªãã«ããå¿ èŠããããããã«70åã®èŠåãæ¶ããŸãã
ããã°ã©ããŒãèªåã«ããã»ã©èªä¿¡ããªãå Žåã¯ãäœããããªããã°ãªããŸãããã³ãŒãããªãã¡ã¯ã¿ãªã³ã°ã§ããŸãïŒ
static bool lcl_parseDate(....) { bool bSuccess = true; .... if (bSuccess) { ++nPos; bSuccess = readDateTimeComponent(string, nPos, nDay, 2, true); .... }
æãéèŠãªããšã¯ã誀æ€ç¥ã«é¢ããŠæ·±å»ãªåé¡ããªãããšã§ããèŠåã®ã°ã«ãŒãã圌ã®ãããžã§ã¯ãã®äººã«ãšã£ãŠç¡æå³ã§ãããšæãããå Žåã圌ã¯åã«ããããç¡å¹ã«ããç 究ãã¹ãèŠåã®æ°ãå€§å¹ ã«æžãããŸãã圌ã®æèŠã§ã¯ãã³ãŒãã調ã¹ãŠä¿®æ£ããå¿ èŠãããå Žåããããã¯èª€ã£ãã¢ã©ãŒã ã§ã¯ãªããå®éã«åœ¹ç«ã€èŠåã§ãã
ã泚ææ°çŸãŸãã¯æ°åã®ã¢ã©ãŒããèŠãªããŠãã¢ãã©ã€ã¶ãŒã®äœ¿çšãéå§ã§ããŸããæ°ããã¡ãã»ãŒãžããŒã¯ã¢ããã¡ã«ããºã ã䜿çšã§ããŸããååšãããã¹ãŠã®èŠåãé衚瀺ã«ããæ°ããã³ãŒãã«è¡šç€ºãããã¡ãã»ãŒãžã®ã¿ã確èªããå¿ èŠããããŸãããŸããç·æ¥ã®åé¡ãçºçããããšãªããããã«å€ãã³ãŒãã®ãšã©ãŒã«æ»ãããšãã§ããŸãã
ãããã«
ãã€ãã®ããã«ãç§ã®èšäºã«ã¯å€ãã®ãšã©ãŒãæ¬ ç¹ã誀ãããªã¹ããããŠããŸãããLibreOfficeã³ãŒãã¯éåžžã«é«å質ã§ããã¯ããã³ããªãã£ãå®æçã«äœ¿çšããããšã¯ãéçºã«å¯Ÿããçå£ãªã¢ãããŒãã瀺ããŠããŸãããããžã§ã¯ãã®å Žåããã®ãšã©ãŒã®éã¯ãããããã§ãã
ãã®èšäºã§äœãèšãããã§ããïŒã¯ããäžè¬çã«ã¯äœããããŸãããã¡ãã£ãšããåºåãªã©ãPVS-Studioéçã¢ãã©ã€ã¶ãŒãå®æçã«äœ¿çšãããšãåæ段éã§å€ãã®å€±æãèŠã€ãããŸãã
ç§ã¯æåŸã®åçã®çã®ããã§ãã圌ã¯æ¥ãŠãããããã®ééããéããŠéããŸããããããŠãLibreOfficeã®äœè ã¯ä»ããããããéããŠããŸããããããªãã ãããç§ã®ä»äºã§ãã
ãã®èšäºã¯è±èªã§ãã
ãã®èšäºãè±èªåã®èŽè¡ãšå ±æãããå Žåã¯ã翻蚳ãžã®ãªã³ã¯ã䜿çšããŠãã ããïŒAndrey Karpovã LibreOfficeãããžã§ã¯ãã®ãã§ãã¯ã
èšäºãèªãã§è³ªåããããŸããïŒ
å€ãã®å Žåãèšäºã«ã¯åã質åãå¯ããããŸãã ããã§ãããã«å¯ŸããåçãåéããŸããïŒ PVS-Studioããã³CppCatããŒãžã§ã³2014ã«é¢ããèšäºã®èªè
ããã®è³ªåãžã®åç ã ãªã¹ããã芧ãã ããã