Skip to content

Commit 5ed3a9f

Browse files
Lab 7 updates.
1 parent 754a503 commit 5ed3a9f

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

lab7/test/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PRECIOUS: %.ll
22

3-
TARGETS=simple0.out simple1.out branch0.out loop0.out
3+
TARGETS=simple0.out simple1.out branch0.out loop0.out branch1.out branch2.out loop1.out
44

55
all: ${TARGETS}
66

lab7/test/branch1.c

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "prelude.h"
2+
3+
int main(int argc, char **argv) {
4+
int x = tainted_input();
5+
int y;
6+
if (argc > 2) {
7+
x = 0;
8+
y = sanitizer(x);
9+
} else {
10+
y = not_sanitizer(x);
11+
}
12+
int z = 4 / y; // alarm
13+
}

lab7/test/branch2.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "prelude.h"
2+
3+
int main(int argc, char **argv) {
4+
int x = tainted_input();
5+
int y;
6+
if (1) {
7+
y = 0;
8+
} else {
9+
y = 100;
10+
}
11+
int z = 4 / y; // alarm
12+
}

lab7/test/loop1.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "prelude.h"
2+
3+
int main(int argc, char **argv) {
4+
int x;
5+
int y = tainted_input();
6+
x = 0;
7+
while (x > 0) {
8+
y = sanitizer(y);
9+
}
10+
int z = 4 / y; // alarm
11+
}

0 commit comments

Comments
 (0)