1 // This file is distributed under the University of Illinois Open Source 2 // License. See LICENSE.TXT for details. 3 4 // Make sure LLVMFuzzerInitialize is called. 5 #include <assert.h> 6 #include <stddef.h> 7 #include <stdint.h> 8 #include <stdio.h> 9 #include <stdlib.h> 10 #include <string.h> 11 12 static char *argv0; 13 LLVMFuzzerInitialize(int * argc,char *** argv)14extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { 15 assert(argc > 0); 16 argv0 = **argv; 17 return 0; 18 } 19 LLVMFuzzerTestOneInput(const uint8_t * Data,size_t Size)20extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 21 if (strncmp(reinterpret_cast<const char*>(Data), argv0, Size)) { 22 fprintf(stderr, "BINGO\n"); 23 exit(1); 24 } 25 return 0; 26 } 27