File tree Expand file tree Collapse file tree 4 files changed +81
-0
lines changed
regression/goto-cc-goto-analyzer/instrument_preconditions_locations Expand file tree Collapse file tree 4 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ struct evp_md_ctx_st
2+ {
3+ const void * digest ;
4+ };
5+ struct s2n_evp_digest
6+ {
7+ const void * ctx ;
8+ };
9+ union s2n_hash_low_level_digest {
10+ };
11+ struct s2n_hash_evp_digest
12+ {
13+ struct s2n_evp_digest evp_md5_secondary ;
14+ };
15+ struct s2n_hash_state
16+ {
17+ const struct s2n_hash * hash_impl ;
18+ union {
19+ union s2n_hash_low_level_digest low_level ;
20+ struct s2n_hash_evp_digest high_level ;
21+ } digest ;
22+ };
23+ struct s2n_hash
24+ {
25+ int (* free )(struct s2n_hash_state * state );
26+ };
27+ void EVP_MD_CTX_free (struct evp_md_ctx_st * ctx )
28+ {
29+ free (ctx -> digest );
30+ free (ctx );
31+ }
32+ static int s2n_evp_hash_free (struct s2n_hash_state * state )
33+ {
34+ (EVP_MD_CTX_free ((state -> digest .high_level .evp_md5_secondary .ctx )));
35+ return 0 ;
36+ }
37+ static const struct s2n_hash s2n_evp_hash = {
38+ .free = & s2n_evp_hash_free ,
39+ };
40+ static int s2n_hash_set_impl (struct s2n_hash_state * state )
41+ {
42+ state -> hash_impl = & s2n_evp_hash ;
43+ return 0 ;
44+ }
Original file line number Diff line number Diff line change 1+ void s2n_hash_free_harness ()
2+ {
3+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.c
3+ --verify
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ Checking assertions
7+ ^\[EVP_MD_CTX_free.precondition_instance.1\] line \d+ free argument must be NULL or valid pointer: SUCCESS
8+ --
9+ Invariant check failed
10+ --
11+ This test checks that after building the goto binary (see test.sh)
12+ that there is no errors that lead to invariant violations.
13+ This was created after a bug was found due to the
14+ instrument_preconditions code not correctly fixing locations and
15+ the invariant check of partial inlining detecting this location
16+ inconsistency.
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -e
3+
4+ goto_cc=$1
5+ is_windows=$2
6+
7+ if [[ " ${is_windows} " == " true" ]]; then
8+ ${goto_cc} --export-file-local-symbols simple.c
9+ mv simple.exe simple.gb
10+ ${goto_cc} --export-file-local-symbols s2n_hash_inlined.c
11+ mv s2n_hash_inlined.exe s2n_hash_inlined.gb
12+ ${goto_cc} --function s2n_hash_free_harness simple.gb s2n_hash_inlined.gb
13+ mv simple.exe test.gb
14+ else
15+ ${goto_cc} --export-file-local-symbols simple.c -o simple.gb
16+ ${goto_cc} --export-file-local-symbols s2n_hash_inlined.c -o s2n_hash_inlined.gb
17+ ${goto_cc} --function s2n_hash_free_harness simple.gb s2n_hash_inlined.gb -o test.gb
18+ fi
You can’t perform that action at this time.
0 commit comments