[fuzzer] Separate main() into a new file
This commit is contained in:
parent
7ed71eb347
commit
de14c19d14
|
@ -0,0 +1,4 @@
|
||||||
|
#include <hb.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include "hb-fuzzer.hh"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <fstream>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
std::string FileToString(const std::string &Path) {
|
||||||
|
/* TODO This silently passes if file does not exist. Fix it! */
|
||||||
|
std::ifstream T(Path.c_str());
|
||||||
|
return std::string((std::istreambuf_iterator<char>(T)),
|
||||||
|
std::istreambuf_iterator<char>());
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
for (int i = 1; i < argc; i++) {
|
||||||
|
std::string s = FileToString(argv[i]);
|
||||||
|
std::cout << argv[i] << std::endl;
|
||||||
|
LLVMFuzzerTestOneInput((const unsigned char*)s.data(), s.size());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue