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