Blame test/fuzzing/main.cc
|
Packit |
874993 |
#include "hb-fuzzer.hh"
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#include <iostream>
|
|
Packit |
874993 |
#include <iterator>
|
|
Packit |
874993 |
#include <fstream>
|
|
Packit |
874993 |
#include <assert.h>
|
|
Packit |
874993 |
|
|
Packit |
874993 |
std::string FileToString(const std::string &Path) {
|
|
Packit |
874993 |
/* TODO This silently passes if file does not exist. Fix it! */
|
|
Packit |
874993 |
std::ifstream T(Path.c_str());
|
|
Packit |
874993 |
return std::string((std::istreambuf_iterator<char>(T)),
|
|
Packit |
874993 |
std::istreambuf_iterator<char>());
|
|
Packit |
874993 |
}
|
|
Packit |
874993 |
|
|
Packit |
874993 |
int main(int argc, char **argv) {
|
|
Packit |
874993 |
for (int i = 1; i < argc; i++) {
|
|
Packit |
874993 |
std::string s = FileToString(argv[i]);
|
|
Packit |
874993 |
std::cout << argv[i] << std::endl;
|
|
Packit |
874993 |
LLVMFuzzerTestOneInput((const unsigned char*)s.data(), s.size());
|
|
Packit |
874993 |
}
|
|
Packit |
874993 |
}
|