
éçã³ãŒãåæã«é¢ããéåžžã«å€ãã®åèŠãéããç§ã®èšäºã®1ã€ã«ã³ã¡ã³ããããããã®çããå¥ã®åºçç©ã«æ²èŒããããšã«ããŸããã ãã®åçã«ãããã³ã¡ã³ãäœæè ãšçããããã¹ãŠã®ããã°ã©ããŒããéçåæããŒã«å šè¬ãç¹ã«PVS-Studioãå確èªã§ããããã«ãªãããšãé¡ã£ãŠããŸãã
ã³ã¡ã³ã
ã³ã¡ã³ãã¯ãã Yandexã®éçºè ã«æšæ¶ããŸãããšããèšäºã«æžãããŠããŸãã æåã¯ããã§ãã åŒçšããŸãïŒ
ãããã®ãã¹ãŠã®ã¢ãã©ã€ã¶ãŒã¯ãå©çãé€ããŠããã«ãã誀æ€ç¥ãæ
å ±ãã€ãºãããã³èª€ã£ãå®å¿æãé
ããããšãã圢ã§åºè¡ãè¿œå ããŸãã ç§ã«ãšã£ãŠã¯ãå°é家ã«ãšã£ãŠãã®ãããªããŒã«ã¯å°ãªãã»ã©è¯ããšå€æããŸãã-åºè¡ã¯ç°¡åã«å©çãäžåããŸãã ããããããã¯NubasisãããŸãå©ããŸãã-圌ãã¯ãŠããããã¹ããæžãããšãåŠã³ãèŠåãå·®ã蟌ãæéãç¡é§ã«ããŸããã ãããããYandexã¯åãããã«èããŠããŸãã
ãªãªãŒã¹åã«ãã¹ããè¡ããšãåºè¡ãå°ãªããªããéåžžã®æé/ãšã©ãŒçã远跡ã§ããããã«ãªããŸãã®ã§ãxsã å 責äºé ïŒPVS-Studioç§ã¯è©ŠããŠããŸããã |
çã®ç«¶åä»ç€ŸïŒäºå®äžã§ã¯ãªããäºå®äžã®ïŒãå¿ããªãã§ãã ããïŒåçã¢ãã©ã€ã¶ãŒïŒASANãMSANãTSANãUBSANïŒã ãã¡ããã圌ãã«ã¯åé¡ããããŸãã圌ãã¯ããã»ã©éãåäœãããããå€ãã®ãªãœãŒã¹ãå¿
èŠãšããŸãã ãããããããã«ã¯å©ç¹ããããŸãããã¡ãžã³ã°äžã«SANãæ¢ã«ããã®ãããªãäœããèŠã€ããå Žåãåæã¯åœ¹ã«ç«ããªã-ããã¯ééãã§ããä¿®æ£ããå¿
èŠããããŸãã ãããŠãéçã¢ãã©ã€ã¶ãŒã§ã¯...äœã§ãèµ·ããåŸãŸãã
ãããã£ãŠãclang / gcc / msvcïŒç¡æã§åžžã«å©çšå¯èœïŒã«çµã¿èŸŒãŸããã¢ãã©ã€ã¶ãŒãš* SAN'omïŒå°é£ã§é«äŸ¡ã§ãã誀æ€ç¥-ã»ãŒãŒãããšã©ãŒã¯ããã«ãã°ãã©ãã«ãŒã«å ¥åã§ããŸãïŒã®éã®ãããã«å ¥ãå¿ èŠããããŸãã ãã®ãããã¯ãšãŠã倧ããã§ããïŒ |
ç§ã®æèŠã§ã¯ããããã¯éåžžã«è¯ãã³ã¡ã³ãã§ãããéçã³ãŒãåæã«é¢ãã誀解ã®éåçãªã€ã¡ãŒãžãšããŠäœ¿çšã§ããŸãã ããããã®éèŠãªçºèšã泚ææ·±ã調ã¹ãŠã¿ãŸãããã
PVS-Studioéçã¢ãã©ã€ã¶ãŒã®ãšãã³ãžã§ãªã¹ãã®ç«å Žãã話ãããŸãããç§ãèšãããšã¯ãã¹ãŠãéç解æããŒã«å šè¬ã«é¢é£ãããã®ã§ãã
ã¢ãã©ã€ã¶ãŒã¯äž»ã«æ³šææ£æŒ«ãªãã€ãºãçæããŸã
ãããã®ãã¹ãŠã®ã¢ãã©ã€ã¶ãŒã¯ãå©çãé€ããŠããã«ãã誀æ€ç¥ãæ å ±ãã€ãºãããã³èª€ã£ãå®å¿æãé ããããšãã圢ã§åºè¡ãè¿œå ããŸãã ç§ã«ãšã£ãŠã¯ãå°é家ã«ãšã£ãŠãã®ãããªããŒã«ã¯å°ãªãã»ã©è¯ããšå€æããŸãã-åºè¡ã¯ç°¡åã«å©çãäžåããŸãã
éçã¢ãã©ã€ã¶ãŒã¯ãã³ã³ãã€ã©ã«å®è£ ãããŠããèŠåã¡ã«ããºã ã®é«ã¬ãã«ã§ã€ã³ããªãžã§ã³ããªããŒãžã§ã³ã§ãã å®éãéçã¢ãã©ã€ã¶ãŒã«å®è£ ãããŠããäžéšã®èšºæã¯ãã³ã³ãã€ã©ãŒã«åŸã ã«çŸããŸãã ããŒã¹ãã©ã€ãã©ãªããstdã©ã€ãã©ãªã«äœããå ¥ããããªãã®ã§ãã åæã«ãããŒã¹ãã©ã€ãã©ãªã¯åç¶ããå©ç¹ããããããŸãã é¡æšã¯æè¯ã§ã¯ãªããããããŸãããããã®èãã¯æ確ã ãšæããŸãã
ãã®ãããã¢ãã©ã€ã¶ãŒã¯ã³ã³ãã€ã©ãŒãããã³ãŒããå®æ§çãã€è©³çŽ°ã«æ€æ»ããŸãã ããã«ãåªããã¢ãã©ã€ã¶ãŒã®èª€æ€ç¥ã®å²åã¯ãã³ã³ãã€ã©ãŒã®å Žåãããã¯ããã«å°ãªãã§ãã ããã«ãéçåæããŒã«ã¯ã䜿çšãç°¡çŽ åããå€ãã®è¿œå æ©èœãæäŸããŸãã ãã®ããã«ãã¢ãã©ã€ã¶ãŒã®éçºè ã¯ãéãåãåããŸãã
ç§ã¯æ¬¡ã®ã¿ã€ãã®ç°è°ãäºèŠããŸãïŒãããªããè£ é£Ÿãã誀æ€ç¥ã®å²åã«ã€ããŠã ã³ã³ãã€ã©ã¯ã»ãšãã©èŠåãçæããŸãããéçã¢ãã©ã€ã¶ãŒãå®è¡ãããšãäœåãã®èŠåã衚瀺ãããŸãã
ãã¹ãŠãéåžžã«ç°¡åã§ããå®éãã¢ãã©ã€ã¶ãŒã¯èª¿æŽãããŠããŸããã æ¯èŒã¯äžå ¬å¹³ã§ãã ãŸã ã³ã³ãã€ã©ã§äœ¿çšãããŠããªãå¥ã®ã³ãŒãã§ã³ãŒããã³ã³ãã€ã«ããŠã¿ãŠãã ãããåãèŠåã衚瀺ãããŸããæ°äžããŸãã¯æ°äžã®èŠåã衚瀺ãããŸãã ãããŠãããã¯äžè¬ã«ãå®äºããã«ã³ãŒããã³ã³ãã€ã«ããããã«ããã«å€æããããšãæäŸãããŠããŸãã
åè¿°ããããã«ãåªããéçã³ãŒãã¢ãã©ã€ã¶ãŒã¯èª€æ€ç¥ãã»ãšãã©çºçãããã誀æ€ç¥ãç°¡åã«æå¶ã§ããŸãã èšå®ã«å°ãæéããããã ãã§ãã ãããã®èãã¯ãç§ã®èšäºã EFLã³ã¢ã©ã€ãã©ãªã®äŸã䜿çšããPVS-Studioã¢ãã©ã€ã¶ãŒã®ç¹æ§ã誀æ€ç¥ã®10ã15ïŒ ãã§è©³ãã説æãããŠããŸãã
ç§ã¯äž»ãªã¢ã€ãã¢ããå°ãé¢ããŸããããéçã¢ãã©ã€ã¶ãŒã¯ã³ã³ãã€ã©ãŒã§èŠåãçæããã¡ã«ããºã ããã匷åãªããŒã«ã§ããããšã説æããªããã°ãªããŸããã§ããã
ãã®ãããéç解æã®æŸæ£ã¯ããã¹ãŠã®ã³ã³ãã€ã©èŠåããªãã«ããã®ãšåããããæããªããšã§ãã èŠãŠãå ã®ã³ã¡ã³ããå°ãæžãæããŸãããïŒ
ã³ã³ãã€ã©ãŒã«ãã£ãŠçºè¡ããããããã®ãã¹ãŠã®èŠåã¯ãæçšæ§ã«å ããŠããã«ãã®é 延ã誀æ€ç¥ãæ å ±ãã€ãºãããã³èª€ã£ãå®å¿æãšãã圢ã§åºè¡ãè¿œå ããŸãã ç§ã«ãšã£ãŠã¯ãå°é家ã«ãšã£ãŠãã®ãããªããŒã«ã¯å°ãªãã»ã©è¯ããšå€æããŸãã-åºè¡ã¯ç°¡åã«å©çãäžåããŸãã
é©åãªããã°ã©ãã§ããã°ããã³ã»ã³ã¹ãæžãããŠãããšèšãã§ãããã ã¯ããã³ã³ãã€ã©ã®èŠåã¯æã ãã€ãºã§ãã ããããããã¯åœŒãã®å©çãåŠå®ãããã®ã§ã¯ãããŸããã
ã³ã³ãã€ã©ã®èŠåã誀ã£ãå®å¿æãäžãããšèª°ããèšã£ãå Žåãããã¯çºèšè ã®åé¡ã§ãããã³ã³ãã€ã©ã®åé¡ã§ã¯ãããŸããã
æåŸã«ãèŠåã«ãã害ãå©çãäžåããšããäºå®ã¯ããããã§ãã·ã§ããªãºã ããŸã£ããäžããŸããããéã«ããã®ãããªããã°ã©ããŒã®ãããšããŠã®äžé©æ Œæ§ãäžããŸãã ã³ã³ãã€ã©ã®èŠåã®äœ¿çšæ¹æ³ãç¥ããªãã ãã§ãã
ãæ³åã®ãšãããéçã³ãŒãåæã«ãåãããšãåœãŠã¯ãŸããŸãã 誀解ã®æåã®éšåã詳现ã«æ€èšãã次ãžãšé²ã¿ãŸãã
åå¿è ã«ã¯éçåæã¯äœ¿çšã§ããŸãã
ããããããã¯NubasisãããŸãå©ããŸãã-圌ãã¯ãŠããããã¹ããæžãããšãåŠã³ãèŠåãå·®ã蟌ãæéãç¡é§ã«ããŸããã
äœããããŸããåå¿è ã¯ããã°ã©ãã³ã°èšèªãã³ãŒãã®ãããã°æ¹æ³ãåäœãã¹ãã®æžãæ¹ãªã©ãåŠã¶å¿ èŠãããããšã«åæããŸãã åºæ¬çãªç¥èããªããã°ãæ¯æŽããŒã«ã¯åœ¹ã«ç«ã¡ãŸããã
ã¯ãããããããéçåæã¯ããããã泚æãæãã¹ãæè¡ã§ã¯ãããŸããã ãã ããéçåæã¯ãéçºè ã®ããæèã«é¢ä¿ãªããåžžã«å人ã§ãã çåŸã«ãšã£ãŠã¯ãã³ãŒãã«äœãåé¡ãããããšãäŒãããããªãèšèªåŠç¿ã®ããã®é£ç©ãæäŸããã®ã«åœ¹ç«ã€ãããããŸããã ãšããã§ãåŠçã®ã³ãŒãããã§ãã¯ããããšã«ã€ããŠã®èå³æ·±ãèšäºããããŸãïŒã éè¡åž«ã®åŠçã«ãã£ãŠå¶ç¶ã«åŒã°ããæªã«ã€ããŠã ã
æ°å ¥ç€Ÿå¡ã«ã€ããŠã§ã¯ãªããããšãã°æ°å ¥ç€Ÿå¡ã«ã€ããŠè©±ããŠããå Žåãéçåæã«ãããããŒã ãªãŒããŒã¯ããã°ã©ããäœã§ãããäœãåŠã¶ã¹ããããã°ããç解ã§ããŸãã
ã泚æ ãšããã§ãåäœãã¹ããäžèœè¬ã§ã¯ãããŸãããéçã¢ãã©ã€ã¶ãŒã¯ãã®æ¹æ³è«ãè£å®ãããã®ã§ããã競åããŸããã èšäºã éçåæãTDDãè£å®ããæ¹æ³ ããåç §ããŠãã ããã
ãªãªãŒã¹åã«éçã¢ãã©ã€ã¶ãŒãå®è¡ã§ããŸã
ãªãªãŒã¹åã«ãã¹ããè¡ããšãåºè¡ãå°ãªããªããéåžžã®æé/ãšã©ãŒçã远跡ã§ããããã«ãªããŸãã®ã§ãxsã
ããã¯ãã¢ãã©ã€ã¶ãŒã䜿çšãããŸã£ããééã£ãæ¹æ³ã§ãïŒ ææªã®ã·ããªãªã¯ãéçåæããŸã£ãã䜿çšãããªããã5幎ããšã«äœ¿çšãããå Žåã§ãã
ãã®ã¢ãããŒãã§ã¯ããŠããããã¹ãããããã°ããã¹ã¿ãŒãªã©ã䜿çšããŠããã¹ãŠã®ãšã©ãŒããã£ãããšæ²ããæ€çŽ¢ãããŸãã ãããŠãã¢ãã©ã€ã¶ãŒã®å©ããåããŠãªãªãŒã¹ããã§ãã¯ãã段éã§ã倧éšåã¯è»œåŸ®ãªãšã©ãŒãèŠã€ãããŸããããããã¯éèŠã§ãªãããã«ä»¥åã«ã¯çºèŠãããŸããã§ããã
éçåæã®ãã€ã³ãã¯ãã§ããã ãæ©ããšã©ãŒãæ€åºããããšã§ãïŒ ã€ãŸããã³ãŒããæžã段éã§ãã ããã¯ãéçã¢ãã©ã€ã¶ãŒãæãæéãç¥çµããéãç¯çŽããæ¹æ³ã§ãã
ããã§ããã³ã³ãã€ã©ã®èŠåãšã®é¡æšãé©åã§ãã èŠåãå®å šã«ç¡å¹ã«ãªãããããžã§ã¯ãã3ãæééçºããããšããŸãã ãããŠããªãªãŒã¹ã®åæ¥ãããããã¹ãŠã®ã³ã³ãã€ã©èŠåããªã³ã«ãªããŸãã åæããŸããããã¯ããçš®ã®æããã§ãã
ãŸããããã§ã¯ãã¯ã³ã¿ã€ã ã¢ãã©ã€ã¶ãŒã®æããã«é¢ããå°é家ã®èšäºã«ç²Ÿéããããšãææ¡ããããšãé©åã§ããã éçã³ãŒãåæã®å²åŠïŒ100人ã®ããã°ã©ããŒãããŸããã¢ãã©ã€ã¶ãŒã¯ãšã©ãŒãã»ãšãã©èŠã€ããŸããã§ããã ããã¯åœ¹ã«ç«ã¡ãŸãããïŒ ã
åçåæ-éçåæã®ç«¶å
ç㮠競åä»ç€ŸïŒäºå®äžã§ã¯ãªããäºå®äžã®ïŒã å¿ããªãã§ãã ãã ïŒåçã¢ãã©ã€ã¶ãŒïŒASANãMSANãTSANãUBSANïŒã ãã¡ããã圌ãã«ã¯åé¡ããããŸãã圌ãã¯ããã»ã©éãåäœãããããå€ãã®ãªãœãŒã¹ãå¿ èŠãšããŸãã ãããããããã«ã¯å©ç¹ããããŸãããã¡ãžã³ã°äžã«SANãæ¢ã«ããã®ãããªãäœããèŠã€ããå Žåãåæã¯åœ¹ã«ç«ããªã-ããã¯ééãã§ããä¿®æ£ããå¿ èŠããããŸãã ãããŠãéçã¢ãã©ã€ã¶ãŒã§ã¯...äœã§ãèµ·ããåŸãŸãã
ã¯ããåçã¢ãã©ã€ã¶ãŒã«ã¯å©ç¹ããããŸãããæ¬ ç¹ããããŸãã åçã¢ãã©ã€ã¶ãŒã¯ãéçã¢ãã©ã€ã¶ãŒãæ°ä»ããªããšã©ãŒãèŠã€ããããšãã§ããŸãã ãããŠãã®éïŒ åçã¢ãã©ã€ã¶ãŒã«ã¯ãã»ãšãã©èª€æ€åºããããŸããã ããããããã°ã©ã ã®äžéšããã¹ãããã®ã¯éåžžã«é£ããããæéãããããããŸãã ããã©ããããéçã¢ãã©ã€ã¶ãŒã¯ãœãŒã¹ã³ãŒãå šäœãéåžžã«è¿ éã«ãã§ãã¯ããŸãã
ãéçåæ察åçåæãã®ç²Ÿç¥ã§ããããã®æ¹æ³è«ãèæ ®ããªãããšãéèŠã§ãã ãããã®ãã¯ãããžãŒã¯ç«¶åããŸããããäºãã«è£å®ããŸãã éçåæãšåçåæãçµã¿åãããŠäœ¿çšââãããšãèšå€§ãªæ°ã®ããŸããŸãªãšã©ãŒãç¹å®ã§ããŸãã
ããã®ããã°ã©ããŒã¯ãäœãéžã¶ã¹ããïŒããšãã質åãæããããªãããããã€ãããã¯ã¢ãã©ã€ã¶ãŒã競åä»ç€Ÿãšã¯èŠãªããŸããã 圌ãã¯ãããã®ãã¯ãããžãŒã®äž¡æ¹ã䜿çšããŸãããªããªããã©ã¡ãããã³ãŒãã®å質ãæ¹åããããã«ä»ã«äœãã§ããã§ããããïŒããšãã質åã«çããã®ã«åœ¹ç«ã€ããã§ãã
ã泚æ
ã¡ãªã¿ã«ãç§ãç解ã§ããªãäœããã®çç±ã§ãäžéšã®ããã°ã©ããŒã¯ãåçã¢ãã©ã€ã¶ãŒãéçã¢ãã©ã€ã¶ãŒãšåãããšãè¡ãããšãã§ãããšä¿¡ããŠããŸãã ããããããã¯ããã§ã¯ãããŸãã;åçã¢ãã©ã€ã¶ãŒã¯å€ããè¡ãããšãã§ããŸããã ãã®ããŒãã«é¢ãã2ã€ã®åªããåºçç©ããããŸãã
- éçããã³åçã³ãŒãåæ ã
- éçã¢ãã©ã€ã¶ãŒã䜿çšããŠãåçã¢ãã©ã€ã¶ãŒValgrindã®ã³ãŒãããã§ãã¯ããŸã ã
ã³ã³ãã€ã©ãšåçã¢ãã©ã€ã¶ãŒã®éã®ãããã«äŸµå ¥ããããšã¯å°é£ã§ã
ãããã£ãŠãclang / gcc / msvcïŒç¡æã§åžžã«å©çšå¯èœïŒã«çµã¿èŸŒãŸããã¢ãã©ã€ã¶ãŒãš* SAN'omïŒå°é£ã§é«äŸ¡ã§ãã誀æ€ç¥-ã»ãŒãŒãããšã©ãŒã¯ããã«ãã°ãã©ãã«ãŒã«å ¥åã§ããŸãïŒã®éã®ãããã«å ¥ãå¿ èŠããããŸãã ãã®ãããã¯ãšãŠã倧ããã§ããïŒ
ãããã¯åºããPVS-Studioã¢ãã©ã€ã¶ãŒã ãã§ãªããSonarSourceãSynopsysïŒä»¥åã®CoverityïŒãGimpel SoftwareãRogue Wave Softwareãªã©ãä»ã®å€ãã®äŒæ¥ã®ããŒã«ã«ãé©åããŠããŸãã
ããããåºãã®ã¯ãªãã§ããïŒ çãã¯ç°¡åã§ããã³ã¡ã³ãã®å£°ã¯éçã³ãŒãã¢ãã©ã€ã¶ãŒãå¶éããŸããã 1ã€ã®å¢çã§åçã¢ãã©ã€ã¶ãŒãèšå®ããŸãã ãããã以åã«å€æããããã«ã競äºã¯ãããŸããããå奜çãªå ±çããããŸãã
ããäžæ¹ã®ç«¯ã¯ã³ã³ãã€ã©ã§ãã ã¯ããã³ã³ãã€ã©ã¯ããã¹ããŒãã«ãªã£ãŠããŸãã ãã ããéç解æããŒã«ãéæ¢ããŠããããæ¥éã«éçºãããŠããŸãã
æçè«è ã®ããã«ãç§ã¯PVS-Studioããããã®ã³ã³ãã€ã©ã®ãšã©ãŒãç°¡åã«èŠã€ããããšã瀺ãå€ãã®åºçç©ãæã£ãŠããŸãã
- æ€èšŒLLVMïŒClangïŒ ïŒ2011幎8æïŒã 2åç®ã®æ€æ» ïŒ2012幎8æïŒã 3åç®ã®æ€æ» ïŒ2016幎10æïŒ
- GCCã¬ãã¥ãŒ ïŒ2016幎8æïŒ
- Visual C ++ã³ãŒãã¯éããããŠããŸãã ãã ããã©ã€ãã©ãªã確èªããPVS-Studioã®æ©èœãå®èšŒããããšã¯ã§ããŸãã Visual C ++ã©ã€ãã©ãªæ€èšŒ ïŒ2012幎9æïŒã 2çªç®ã®æ€èšŒ ïŒ2014幎10æïŒã 3çªç®ã®æ€èšŒ ïŒ2017幎5æïŒ
PVS-Studioè©Šããããšããªã
ç¡é§ã«ã:)ãè©ŠããŠãã ããã å€ãã®äººã ãããã奜ã¿ã圌ãã¯ç§ãã¡ã®é¡§å®¢ã«ãªããŸã ã
ããã«ãPVS-Studioãè©Šãã®ã¯éåžžã«ç°¡åã§ãã 補åããŒãžã«ç§»åã㊠ããã¢çãããŠã³ããŒãããŸãã
ãäžæãªç¹ãããããŸãããããµããŒãã«ãæ°è»œã«ãåãåãããã ããã 倧èŠæš¡ãããžã§ã¯ãã®åæãèŠåãžã®å¯ŸåŠãããã³ã©ã€ã»ã³ã¹ãªãã·ã§ã³ã«é¢ããã¢ããã€ã¹ãæäŸã§ããŸãã
ãæž èŽããããšãããããŸãããã³ãŒãã¬ã¹ã³ãŒãããç¥ãããŸãã