harfbuzz/test/fuzzing/main.cc

29 lines
503 B
C++
Raw Normal View History

#include "hb-fuzzer.hh"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main (int argc, char **argv)
{
hb_blob_t *blob = hb_blob_create_from_file (argv[1]);
2019-05-12 00:48:41 +02:00
unsigned int len;
const char *font_data = hb_blob_get_data (blob, &len);
if (len == 0)
{
2018-10-11 21:42:54 +02:00
printf ("Font not found.\n");
exit (1);
}
2019-05-12 00:48:41 +02:00
for (int i = 1; i < argc; i++)
{
printf ("%s\n", argv[i]);
LLVMFuzzerTestOneInput ((const uint8_t *) font_data, len);
}
hb_blob_destroy (blob);
return 0;
}