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 // Break through a series of strcmp.
12 bool Eq(const uint8_t *Data
, size_t Size
, const char *Str
) {
14 size_t Len
= strlen(Str
);
15 if (Size
< Len
) return false;
16 if (Len
>= sizeof(Buff
)) return false;
17 memcpy(Buff
, (const char*)Data
, Len
);
19 int res
= strcmp(Buff
, Str
);
23 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data
, size_t Size
) {
24 if (Eq(Data
, Size
, "ABC") &&
25 Size
>= 3 && Eq(Data
+ 3, Size
- 3, "QWER") &&
26 Size
>= 7 && Eq(Data
+ 7, Size
- 7, "ZXCVN")) {
27 fprintf(stderr
, "BINGO\n");