Home | History | Annotate | Download | only in test
      1 // This file is distributed under the University of Illinois Open Source
      2 // License. See LICENSE.TXT for details.
      3 
      4 
      5 #include <cstring>
      6 #include <cstdint>
      7 #include <cstdio>
      8 #include <cstdlib>
      9 
     10 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
     11   int Matches = 0;
     12   for (size_t i = 0; i + 2 < Size; i += 3) {
     13     const char *Pat = i % 2 ? "foo" : "bar";
     14     if (!memcmp(Data + i, Pat, 3))
     15       Matches++;
     16   }
     17   if (Matches > 20) {
     18     fprintf(stderr, "BINGO!\n");
     19     exit(1);
     20   }
     21   return 0;
     22 }
     23