Imported Upstream version 2.6.4
[platform/upstream/harfbuzz.git] / test / fuzzing / main.cc
1 #include "hb-fuzzer.hh"
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <assert.h>
6
7 int main (int argc, char **argv)
8 {
9   hb_blob_t *blob = hb_blob_create_from_file (argv[1]);
10
11   unsigned int len;
12   const char *font_data = hb_blob_get_data (blob, &len);
13   if (len == 0)
14   {
15     printf ("Font not found.\n");
16     exit (1);
17   }
18
19   for (int i = 1; i < argc; i++)
20   {
21     printf ("%s\n", argv[i]);
22     LLVMFuzzerTestOneInput ((const uint8_t *) font_data, len);
23   }
24
25   hb_blob_destroy (blob);
26
27   return 0;
28 }