Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jwilk/detsan

determinism sanitizer
https://github.com/jwilk/detsan

fuzzing qa security

Last synced: about 20 hours ago
JSON representation

determinism sanitizer

Awesome Lists containing this project

README

        

Overview
========

**detsan** leverages `clang's code coverage instrumentation
`_
to help you find sources of non-determinism in C (or C++) programs.

.. code:: console

$ cat -n target.c
1 #include
2 #include
3
4 int main(int argc, char **argv)
5 {
6 FILE *fp = fopen("/dev/urandom", "r");
7 if (fp == NULL)
8 abort();
9 unsigned int v;
10 size_t r = fread(&v, sizeof v, 1, fp);
11 if (r != 1)
12 abort();
13 if (v & 1U)
14 puts("Looks like an odd number to me!");
15 else
16 puts("An even number? How quaint!");
17 fclose(fp);
18 return 0;
19 }

$ clang -g -fsanitize-coverage=trace-pc-guard -fsanitize=address target.c -o target

$ detsan ./target
+ /path/to/target.c:16:9 (main)
- /path/to/target.c:14:9 (main)

Prerequisites
=============

* Python ≥ 3.6

* Clang ≥ 4.0

.. vim:ft=rst ts=3 sts=3 sw=3 et