18 research outputs found
Scaling Symbolic Execution to Large Software Systems
Static analysis is the analysis of a program without executing it, usually
carried out by an automated tool. Symbolic execution is a popular static
analysis technique used both in program verification and in bug detection
software. It works by interpreting the code, introducing a symbol for each
value unknown at compile time (e.g. user-given inputs), and carrying out
calculations symbolically. The analysis engine strives to explore multiple
execution paths simultaneously, although checking all paths is an intractable
problem, due to the vast number of possibilities.
We focus on an error finding framework called the Clang Static Analyzer, and
the infrastructure built around it named CodeChecker. The emphasis is on
achieving end-to-end scalability. This includes the run time and memory
consumption of the analysis, bug presentation to the users, automatic false
positive suppression, incremental analysis, pattern discovery in the results,
and usage in continuous integration loops. We also outline future directions
and open problems concerning these tools.
While a rich literature exists on program verification software, error
finding tools normally need to settle for survey papers on individual
techniques. In this paper, we not only discuss individual methods, but also how
these decisions interact and reinforce each other, creating a system that is
greater than the sum of its parts. Although the Clang Static Analyzer can only
handle C-family languages, the techniques introduced in this paper are mostly
language-independent and applicable to other similar static analysis tools
Detecting lifetime errors of std::string_view objects in C++
std::string view is a reference-like data structure in the C++ Standard Template Library (STL) that enables fast and cheap processing of read-only strings. Due to its wide applicability and performance enhancing power, std::string view has been very popular since its introduction in the C++17 standard. However, its careless use can lead to serious memory management bugs. As the lifetime of a std::string view is not tied to the lifetime of the referenced string in any way, it is the user\u27s responsibility to ensure that the view is only used while the viewed string is live and its buffer is not reallocated.
This paper describes a static analysis tool that finds programming errors caused by the incorrect use of std::string view. Our work included modeling std::string view operations in the analysis, defining steps to detect lifetime errors, constructing user-friendly diagnostic messages, and performing an evaluation of the checker
Static Code Analysis with CodeChecker
CodeChecker is an open source project that integrates different static
analysis tools such as the Clang Static Analyzer and Clang-Tidy into the build
systems, continuous integration loops, and development workflows of C++
programmers. It has a powerful issue management system to make it easier to
evaluate the reports of the static analysis tools.
This document was handed out as supportive material for a code analysis
lecture at the 2018 3COWS conference in Kosice, Slovakia
Implementing and Executing Static Analysis Using LLVM and CodeChecker
Static analysis is a method of analyzing source code without executing it. It is widely used to find bugs and code smells in industrial software. Besides other methods, the most important techniques are those based on the abstract syntax tree and those performing symbolic execution. Both of these methods found their role in modern software development as they have different advantages and limitations. In this tutorial, we present two problems from the C++ programming language: the elimination of redundant pointers, and the reporting of dangling pointers originating from incorrect use of the std::string class. These two issues have different theoretical backgrounds and finding them requires different implementation techniques. We will provide a step-by-step guide to implement the checkers (software to identify the aforementioned problems) - one based on the abstract syntax analysis method, the other exploring the possibilities of symbolic execution. The methods are explained in great detail and supported by code examples. The intended audience for this tutorial are both architects of static analysis tools and developers who want to understand the advantages and constraints of the different methods
An Extension to the Subtype Relationship in C++ Implemented with Template Metaprogramming
Families of independent classes, where each class represents a separate, orthogonal concern are highly attractive for implementing collaboration-based design. However, required subtype relationship between such families cannot be expressed in many programming languages
