作者:朱金灿
来源:http://blog.csdn.net/clever101/
从褚诚云博客上知道了Visual Studio 2005 /2008的团队版本上集成了一个C/C++静态代码分析工具Prefast,特地测试了一下,果然不错。
具体用法以下面的例子说明:
1. 建一个控制台工程,敲入下面代码:
2. 打开Project Properties --> Configuration Properties --> Code Analysis -->Enable Code Analysis For C/C++ on build。选择 Yes(/analyze)即可。具体如下图:
如果直接使用CL.exe命令行编译器,采用/analyze编译选项即可。例如:cl test.cpp -W4 /EHsc /analyze。
3. 编译该工程,会出现下面警告:
1>f:\mytest\mytest\src\testsort\testsort.cpp(39) : warning C6001: Using uninitialized memory 'i': Lines: 29, 31, 39
4. 不要以为这是编译器提供的警告,单击一下这个警告你就会发现端倪,原来是Prefast提示你你:当b为假时,变量i未初始化,其中的Lines: 29, 31, 39是提示你这几句代码导致了出现了这个警告,具体如下图:
参考文献:
1. 安全编码实践三:C/C++静态代码分析工具Prefast
,作者:褚诚云
分享到:
相关推荐
1.什么是PrefastPrefast是一种代码分析工具,它能够帮助你找到编译器不能找到的错误或者缺陷。Prefast首次被微软集成到VisualStudio2005TeamSuite中去,使用起来非常方便。2.怎么使用Prefast在vs2005TeamSuite中,...
Prefast是微软研究院提出的静态代码分析工具。主要目的是通过分析代码的数据和控制信息来检测程序中的缺陷。需要强调的是,Prefast检测的缺项不仅仅是安全缺陷,但是安全缺陷类型是其检测的为重要的部分。Prefast...
PREfast(Prefast.exe)是微软公司为驱动程式设计所提供的静态的源代码分析工具(static source code analysis tool),可侦测原始程式码中不易用一般编译器找到的特定类型错误,与Windows DDK 建置环境一同安装。...
c++代码静态检查的利器!告别程序调试。
msvc 2005 compiler prefast
PREfast annotations,
DokanX Dokanx是Dokan 0.6.0的前叉 由于不再维护原始的Dokan,因此我决定分叉它。 您可以在阅读有关原始Dokan的。 有什么改进 ... 已应用PREfast分析器(静态分析驱动程序源代码)。 建造 下载并安装
Software SecurityProgram Analysis with PREfast & SALErik PollDigital Security groupRadboud University Nijmegen1Recap from last week• Buffer overflows notorious source of security flaws in C(++) code...
Software SecurityProgram Analysis with PREfast & SALErik PollDigital Security groupRadboud University Nijmegen1static analysis aka source code analysis aka …Automated analysis at compile time to find...
Support for FT2232C devices. 1.00.2170 (October 27, 2005) Fixed write request synchronization issue. 1.00.2169 (September 1, 2005) Fixed flow control issues. Changed cancel processing to fix ...
Table of Contents ... Chapter 23 - PREfast for Drivers Chapter 24 - Static Driver Verifier Glossary Index List of Figures List of Tables List of Listings List of Sidebars
Break in to Windows and Linux systems with perl scripts, Python scripts, and customized C programs Analyze source code using ITS4, RATS, FlawFinder, PREfast, Splint, and decompilers Understand the ...
Engineering Better Software at MicrosoftJason Yang jasony@microsoft.... PREfast/Esp SALglobal analyzerlocal analyzersource code annotationBinary-level binary instrumentationcode co