blob: 14627479708656b9547c23c955912b83e54d776c [file] [log] [blame]
Kostya Serebryanyaca76962016-01-16 01:23:12 +00001// Make sure LLVMFuzzerInitialize is called.
2#include <assert.h>
3#include <stddef.h>
4#include <stdint.h>
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8
9static char *argv0;
10
11extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
12 assert(argc > 0);
13 argv0 = **argv;
14 return 0;
15}
16
17extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
18 if (strncmp(reinterpret_cast<const char*>(Data), argv0, Size)) {
19 fprintf(stderr, "BINGO\n");
20 exit(1);
21 }
22 return 0;
23}