forked from EdwardStanford7/Fuzz-Panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtriager.cpp
More file actions
30 lines (26 loc) · 753 Bytes
/
triager.cpp
File metadata and controls
30 lines (26 loc) · 753 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
#include "sharehack.h"
#include <cstring>
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <vector>
std::vector<char> read_file(char *path) {
std::ifstream file(path, std::ios::binary | std::ios::ate);
std::streamsize size = file.tellg();
file.seekg(0, std::ios::beg);
std::vector<char> buffer(size);
if (!file.read(buffer.data(), size)) {
std::cout << "(.) couldn't read from file" << path << std::endl;
exit(-1);
}
return buffer;
}
// TODO: change input
int main(int argc, char *argv[]) {
if (argc < 2) {
std::cout << "(.) need to provide an arg to the triager" << std::endl;
return -1;
}
std::vector<char> buf = read_file(argv[1]);
return LLVMFuzzerTestOneInput(buf.data(), buf.size());
}