1 // This file is distributed under the University of Illinois Open Source 2 // License. See LICENSE.TXT for details. 3 4 // Parse some flags 5 #include <string> 6 #include <vector> 7 8 static std::vector<std::string> Flags; 9 10 extern "C" int LLVMFuzzerInitialize(int *Argc, char ***Argv) { 11 // Parse --flags and anything after -ignore_remaining_args=1 is passed. 12 int I = 1; 13 while (I < *Argc) { 14 std::string S((*Argv)[I++]); 15 if (S == "-ignore_remaining_args=1") 16 break; 17 if (S.substr(0, 2) == "--") 18 Flags.push_back(S); 19 } 20 while (I < *Argc) 21 Flags.push_back(std::string((*Argv)[I++])); 22 23 return 0; 24 } 25 26 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 27 fprintf(stderr, "BINGO "); 28 for (auto Flag : Flags) 29 fprintf(stderr, "%s ", Flag.c_str()); 30 fprintf(stderr, "\n"); 31 exit(0); 32 } 33