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
|
|
|
|
|
|
|
extern "C" void 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) {
|
|
|
|
fprintf(stderr, "BINGO\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
2015-05-07 08:11:33 +08:00
|
|
|
}
|
2015-05-07 06:36:00 +08:00
|
|
|
}
|