Skip to content

Commit 6bd3801

Browse files
Edits.
1 parent 5ed3a9f commit 6bd3801

File tree

6 files changed

+58
-2
lines changed

6 files changed

+58
-2
lines changed

lab9/include/Utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void generateLogFiles(std::string &Target, std::string &LogDir) {
9191
exit(1);
9292
}
9393

94-
std::regex Reg("input[0-9]+");
94+
std::regex Reg("input[0-9]+.*");
9595

9696
while ((Ent = readdir(Directory)) != NULL) {
9797
if (!(Ent->d_type == DT_REG))

lab9/reference/InstrumentPass.so

13 KB
Binary file not shown.

lab9/reference/fuzzer

-462 KB
Binary file not shown.

lab9/test/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TARGETS=simple0 simple1 fuzz0 fuzz1
1+
TARGETS=simple0 simple1 fuzz0 fuzz1 fuzz2 fuzz3
22

33
all: ${TARGETS}
44

lab9/test/fuzz2.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <stdio.h>
2+
#include <string.h>
3+
4+
int xval(char *i) {
5+
if ((strlen(i) % 2) == 0) {
6+
return 1;
7+
} else {
8+
return 0;
9+
}
10+
}
11+
12+
int main() {
13+
char input[65536];
14+
fgets(input, sizeof(input), stdin);
15+
int x = 0;
16+
int y = 2;
17+
int z;
18+
19+
if (xval(input)) {
20+
z = y / x;
21+
}
22+
23+
return 0;
24+
}

lab9/test/fuzz3.c

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <stdio.h>
2+
#include <string.h>
3+
4+
int xval(char *i) {
5+
if ((strlen(i) % 2) == 0) {
6+
return 1;
7+
} else {
8+
return 0;
9+
}
10+
}
11+
12+
int main() {
13+
char input[65536];
14+
fgets(input, sizeof(input), stdin);
15+
int x = 0;
16+
int y = 2;
17+
int z;
18+
19+
if (strlen(input) % 7 == 0) {
20+
z = y / x;
21+
}
22+
23+
if (strlen(input) % 13 == 0) {
24+
z = y / ++x;
25+
}
26+
27+
if (xval(input)) {
28+
z = y / x;
29+
}
30+
31+
return 0;
32+
}

0 commit comments

Comments
 (0)