/static-analysis-argumentation

Argumentation around the efficacy of static analysis tooling for C and the Rust compiler in catching software errors pre-runtime.

Primary LanguageCGNU General Public License v2.0GPL-2.0

Static Analysis Argumentation

Evaluation of the efficacy of static analysis tooling for C and the Rust compiler in catching software errors pre-runtime.

C static analysis tooling

Rust tooling

  • rustc

C examples

Dangerous aliasing behavior resulting in unsafe memory access.

Discarding type qualification resulting in unsafe memory access.

Ambiguity of enumerations resulting in unsafe memory access.

Data race resulting in unsafe memory access.

Rust examples

An attempt to implement the dangerous behavior of the corresponding alias.c.

An attempt to implement the dangerous behavior of the corresponding constant.c.

An attempt to implement the dangerous behavior of the corresponding pattern.c.

An attempt to implement the dangerous behavior of the corresponding thread.c.

Usage

C

Each of the C examples should compile with gcc or clang. They should also result in a Segmentation fault report. Because access to the intentionally corrupted data represents undefined behavior, they may not always crash. Running any example a few times will likely reproduce the crash if the first try doesn't.

Rust

Each of the examples should fail to compile with rustc

Results

See ./report-alias.txt, ./report-const.txt, ./report-pattern.txt, ./report-thread.txt for result details for each example.

See ./report-alias_no_ptr_arithmetic.txt for results on alias example without pointer arithmetic.