软件漏洞检测(Bug Finding):Clang Static Analyzer(进阶与实战)

Posted 白马负金羁

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了软件漏洞检测(Bug Finding):Clang Static Analyzer(进阶与实战)相关的知识,希望对你有一定的参考价值。

The Clang Static Analyzer is a source code analysis tool that finds bugs in C, C++, and Objective-C programs. CSA是Clang项目的一部分,而且完全开源。注意这里的静态分析,表示并不需要运行程序——CSA is built on Clang based on symbolic execution technique. It implements a collection of algorithms and techniques used to analyze source code in order to automatically find bugs. 
 

在之前的文章【1】中,我们已经演示了CSA工具的基本使用方法,并体验了一下它的强大漏洞检测能力。但CSA仍然是有一定局限的,本文将由此切入。另外,本文中的例子(部分例子来自【2】)会用到z3,所以在阅读本文之前必须根据【3】中的方法编译启用z3支持的LLVM项目。

CSA sometimes detects false positives because of limitations in the CSA constraint manager。下面就是一个具体的例子。

unsigned int func(unsigned int a)
    unsigned int *z = 0;
    if ((a & 1) && ((a&1)^1))
        return *z;
    return 0;

使用之前的方法对其分析,得到:

以上是关于软件漏洞检测(Bug Finding):Clang Static Analyzer(进阶与实战)的主要内容,如果未能解决你的问题,请参考以下文章

软件漏洞检测(Bug Finding):Clang Static Analyzer(进阶与实战)

网站漏洞修复之vim文本编辑BUG分析与修复方案

软件测试

『软件测试6』bug一两是小事,但安全漏洞是大事!

『软件测试6』bug一两是小事,但安全漏洞是大事!

如何检测网站服务器的漏洞?