forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstruct_init.c
More file actions
47 lines (37 loc) · 815 Bytes
/
struct_init.c
File metadata and controls
47 lines (37 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
void sink(void *o);
void *user_input(void);
struct AB {
void *a;
void *b;
};
struct Outer {
struct AB nestedAB;
struct AB *pointerAB;
};
void absink(struct AB *ab) {
sink(ab->a); //$ ast,ir=20:20 ast,ir=27:7 ast=40:20 MISSING: ir
sink(ab->b); // no flow
}
int struct_init(void) {
struct AB ab = { user_input(), 0 };
sink(ab.a); //$ ast,ir
sink(ab.b); // no flow
absink(&ab);
struct Outer outer = {
{ user_input(), 0 },
&ab,
};
sink(outer.nestedAB.a); //$ ast,ir
sink(outer.nestedAB.b); // no flow
sink(outer.pointerAB->a); //$ ast MISSING: ir
sink(outer.pointerAB->b); // no flow
absink(&outer.nestedAB);
}
int struct_init2(void) {
struct AB ab = { user_input(), 0 };
struct Outer outer = {
{ user_input(), 0 },
&ab,
};
absink(outer.pointerAB);
}