Ouch, finish previous change
This commit is contained in:
parent
de14c19d14
commit
a0688e8e7b
|
@ -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 \
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#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
|
||||
|
|
Loading…
Reference in New Issue