title | layout | nav_order | sidebar |
---|---|---|---|
Tutorials |
home |
1 |
toc |
{:.no_toc}
- List replaced by toc {:toc}
- Download the latest binary release of Frama-C/Codex at https://github.com/codex-semantics-library/codex/releases/
- Write a small C function in file
test.c
:
int main(int i) { int x = i; if(i > 8) x = 8; return x; }
If GCC is not installed, use test.i
instead of test.c
(.i
corresponds to already-preprocessed files).
3. Launch the analysis and obtain a textual report of the analysis:
./frama_c_codex.exe -codex test.c -codex-exp-dump test.dump && cat test.dump
test.c:1.26-27: `i' -> [--..--]
test.c:1.32-37: `i > 8' -> {0; 1}
test.c:1.32-33: `i' -> [--..--]
test.c:1.53-54: `x' -> [-0x80000000..8]
Unproved regular alarms:
Unproved additional alarms:
Proved 0/0 regular alarms
Unproved 0 regular alarms and 0 additional alarms.
Solved 0/0 user assertions, proved 0
If you are using Emacs' compilation-mode (probably works also in other editors), you can click on each expression, and they will bring you to the location in the file. 4. Obtain an HTML report of the analysis:
./frama_c_codex.exe -codex test.c -codex-html-dump test.html
Happy verification!
This is the tutorial accompanying the prototype of our OOPSLA 2024 research paper. It covers all the steps necessary to use our tool to check if a C or machine code program is exempt of spatial memory safety errors, such as null pointer dereferences, buffer overflows, or type confusion errors. It covers in particular:
- How to run the analysis on a C program, how to configure the C analysis, and how to inspect the results.
- How to run the analysis on a binary executable, how to configure the machine code analysis, and how to inspect the results.
- How to specify the types used in a C programs to refine the results of the analysis (which is generally a necessary step to obtain memory safety).