热门问题
时间线
聊天
视角
PREFast for Drivers
来自维基百科,自由的百科全书
Remove ads
PREfast(Prefast.exe)是微软公司为驱动程式设计所提供的静态的原始码分析工具(static source code analysis tool),可侦测原始代码中不易用一般编译器找到的特定类型错误,与Windows DDK建置环境一同安装。目前已集成至Visual Studio 2005 Team Suite中,使用时只要设置‘Enable Code Analysis For C/C++’为‘Yes’即可,接下来PREfast会拦截cl编译器 (cl.exe) 的调用,产生由一次检查所有文件所得的单一联合清单,内容属于XML格式。
此条目没有列出任何参考或来源。 (2016年6月15日) |
侦测错误类别:
- 存储器:内存泄露(memory leak)。
- 资源:没能即时释放资源。
- 函数使用方式:不正确的函数引数、使用某个过时函数的情况。
- 浮点运算状态
- 优先执行规则
- 核心模式程序安全性考量
Remove ads
PREfast的工作
- 变量未初始化
void init() {
int a;
int b;
b = a;
}
- 操作数优先权的问题
void priority() {
int a = 1;
int b = 1;
int c = 1;
if(a & b == c)
return ;
}
- 存储器溢出问题
void overrun() {
char buf[100];
char buf2[200];
int i = 100;
sprintf(buf, "size%d" , i);
strcpy(buf, buf2);
}
- 死循环
void infinite_loop() {
int i;
for(i = 100 ; i >= 0 ; i ++ ) {
;
}
}
- 操作数误用
void op_misuse() {
int a = 2;
if (a = 2)
return ;
}
Remove ads
相关条目
外部链接
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads