test/fuzzing/hb-fuzzer.hh | 4 ++++ test/fuzzing/main.cc | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+)
New commits: commit de14c19d14be90367a1231de56dd347e3f54931c Author: Behdad Esfahbod <beh...@behdad.org> Date: Tue Dec 20 20:50:38 2016 -0600 [fuzzer] Separate main() into a new file diff --git a/test/fuzzing/hb-fuzzer.hh b/test/fuzzing/hb-fuzzer.hh new file mode 100644 index 0000000..d0c617e --- /dev/null +++ b/test/fuzzing/hb-fuzzer.hh @@ -0,0 +1,4 @@ +#include <hb.h> +#include <stddef.h> + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); diff --git a/test/fuzzing/main.cc b/test/fuzzing/main.cc new file mode 100644 index 0000000..4692f7b --- /dev/null +++ b/test/fuzzing/main.cc @@ -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()); + } +} _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz