热门问题
时间线
聊天
视角
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