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