main.cc 503 字节
Newer Older
1 2
#include "hb-fuzzer.hh"

3
#include <stdio.h>
4
#include <stdlib.h>
5 6
#include <assert.h>

E
Ebrahim Byagowi 已提交
7 8
int main (int argc, char **argv)
{
9
  hb_blob_t *blob = hb_blob_create_from_file (argv[1]);
10

11 12
  unsigned int len;
  const char *font_data = hb_blob_get_data (blob, &len);
13 14
  if (len == 0)
  {
B
Minor  
Behdad Esfahbod 已提交
15
    printf ("Font not found.\n");
16 17
    exit (1);
  }
18

19
  for (int i = 1; i < argc; i++)
E
Ebrahim Byagowi 已提交
20
  {
21
    printf ("%s\n", argv[i]);
E
Ebrahim Byagowi 已提交
22
    LLVMFuzzerTestOneInput ((const uint8_t *) font_data, len);
23
  }
24 25

  hb_blob_destroy (blob);
E
Ebrahim Byagowi 已提交
26 27

  return 0;
28
}