2016-04-02 02:38:58 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
|
2015-05-07 06:36:00 +08:00
|
|
|
// Simple test for a fuzzer. The fuzzer must find a particular string.
|
|
|
|
#include <cstring>
|
|
|
|
#include <cstdint>
|
2015-05-07 08:11:33 +08:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
2015-05-07 06:36:00 +08:00
|
|
|
|
2015-10-03 07:34:06 +08:00
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
2015-07-30 09:34:58 +08:00
|
|
|
// TODO: check other sizes.
|
2015-05-07 08:11:33 +08:00
|
|
|
if (Size >= 8 && memcmp(Data, "01234567", 8) == 0) {
|
2015-07-30 09:34:58 +08:00
|
|
|
if (Size >= 12 && memcmp(Data + 8, "ABCD", 4) == 0) {
|
|
|
|
if (Size >= 14 && memcmp(Data + 12, "XY", 2) == 0) {
|
2016-01-14 10:36:44 +08:00
|
|
|
if (Size >= 17 && memcmp(Data + 14, "KLM", 3) == 0) {
|
2016-01-09 09:39:55 +08:00
|
|
|
if (Size >= 27 && memcmp(Data + 17, "ABCDE-GHIJ", 10) == 0){
|
|
|
|
fprintf(stderr, "BINGO %zd\n", Size);
|
|
|
|
for (size_t i = 0; i < Size; i++) {
|
|
|
|
uint8_t C = Data[i];
|
|
|
|
if (C >= 32 && C < 127)
|
|
|
|
fprintf(stderr, "%c", C);
|
|
|
|
}
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2015-07-30 10:33:45 +08:00
|
|
|
}
|
2015-07-30 09:34:58 +08:00
|
|
|
}
|
|
|
|
}
|
2015-05-07 08:11:33 +08:00
|
|
|
}
|
2015-10-03 07:34:06 +08:00
|
|
|
return 0;
|
2015-05-07 06:36:00 +08:00
|
|
|
}
|