提交 a0688e8e 编写于 作者: B Behdad Esfahbod

Ouch, finish previous change

上级 de14c19d
......@@ -30,14 +30,15 @@ LDADD = \
$(NULL)
hb_fuzzer_SOURCES = \
hb-fuzzer.hh \
hb-fuzzer.cc \
main.cc \
$(NULL)
hb_fuzzer_LDADD = \
$(LDADD) \
$(NULL)
hb_fuzzer_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DMAIN \
$(NULL)
hb_fuzzer_DEPENDENCIES = \
lib \
......
#include <stddef.h>
#include <hb.h>
#include "hb-fuzzer.hh"
#include <hb-ot.h>
#include <string.h>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
hb_blob_t *blob = hb_blob_create((const char *)data, size,
HB_MEMORY_MODE_READONLY, NULL, NULL);
hb_face_t *face = hb_face_create(blob, 0);
......@@ -50,25 +50,3 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
hb_blob_destroy(blob);
return 0;
}
#ifdef MAIN
#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());
}
}
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册