1 #include <stdint.h>
2 #include <stddef.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5
6 extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
7
main(int argc,char ** argv)8 int main(int argc, char **argv) {
9 for (int i = 1; i < argc; i++) {
10 fprintf(stderr, "Running: %s\n", argv[i]);
11 FILE *f = fopen(argv[i], "r");
12 fseek(f, 0, SEEK_END);
13 size_t len = ftell(f);
14 fseek(f, 0, SEEK_SET);
15 unsigned char *buf = (unsigned char*)malloc(len);
16 size_t n_read = fread(buf, 1, len, f);
17 LLVMFuzzerTestOneInput(buf, len);
18 free(buf);
19 fprintf(stderr, "Done: %s: (%zd bytes)\n", argv[i], n_read);
20 }
21 }
22