1 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 // See https://llvm.org/LICENSE.txt for license information.
3 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 // Test whether the fuzzer can find "SELECT FROM WHERE", given a seed input
6 // "SELECTxFROMxWHERE". Without -keep_seed=1, it takes longer time to trigger
7 // find the desired string, because the seed input is more likely to be reduced
8 // to a prefix of the given input first, losing useful fragments towards the end
15 static volatile int Sink
= 0;
17 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data
, size_t Size
) {
21 if (Size
>= 6 && Data
[0] == 'S' && Data
[1] == 'E' && Data
[2] == 'L' &&
22 Data
[3] == 'E' && Data
[4] == 'C' && Data
[5] == 'T') {
23 if (Size
>= 7 && Data
[6] == ' ') {
24 if (Size
>= 11 && Data
[7] == 'F' && Data
[8] == 'R' && Data
[9] == 'O' &&
26 if (Size
>= 12 && Data
[11] == ' ') {
27 if (Size
>= 17 && Data
[12] == 'W' && Data
[13] == 'H' &&
28 Data
[14] == 'E' && Data
[15] == 'R' && Data
[16] == 'E') {
29 fprintf(stderr
, "BINGO; Found the target, exiting.\n");