File tree Expand file tree Collapse file tree 4 files changed +73
-0
lines changed
regression/goto-cc-goto-analyzer/instrument_preconditions_locations Expand file tree Collapse file tree 4 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ extern void free (void * __ptr ) __attribute__((__nothrow__ , __leaf__ ));
2
+ struct evp_md_ctx_st {
3
+ const void * digest ;
4
+ };
5
+ struct s2n_evp_digest {
6
+ struct evp_md_ctx_st * ctx ;
7
+ };
8
+ union s2n_hash_low_level_digest {
9
+ };
10
+ struct s2n_hash_evp_digest {
11
+ struct s2n_evp_digest evp_md5_secondary ;
12
+ };
13
+ struct s2n_hash_state {
14
+ const struct s2n_hash * hash_impl ;
15
+ union {
16
+ union s2n_hash_low_level_digest low_level ;
17
+ struct s2n_hash_evp_digest high_level ;
18
+ } digest ;
19
+ };
20
+ struct s2n_hash {
21
+ int (* free )(struct s2n_hash_state * state );
22
+ };
23
+ void EVP_MD_CTX_free (struct evp_md_ctx_st * ctx ) {
24
+ free (ctx -> digest );
25
+ free (ctx );
26
+ }
27
+ static int s2n_evp_hash_free (struct s2n_hash_state * state ) {
28
+ (EVP_MD_CTX_free ((state -> digest .high_level .evp_md5_secondary .ctx )));
29
+ return 0 ;
30
+ }
31
+ static const struct s2n_hash s2n_evp_hash = {
32
+ .free = & s2n_evp_hash_free ,
33
+ };
34
+ static int s2n_hash_set_impl (struct s2n_hash_state * state ) {
35
+ state -> hash_impl = & s2n_evp_hash ;
36
+ return 0 ;
37
+ }
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
+ Checking assertions
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ --
8
+ Invariant check failed
9
+ --
10
+ This test checks that after building the goto binary (see test.sh)
11
+ that there is no errors that lead to invariant violations.
12
+ This was created after a bug was found due to the
13
+ instrument_preconditions code not correctly fixing locations and
14
+ the invariant check of partial inlining detecting this location
15
+ 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 test.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