blob: a3f5349800104aa98931c0a07461b5a83c30ceb4 [file] [log] [blame]
George Karpenkov10ab2ac2017-08-21 23:25:50 +00001// This file is distributed under the University of Illinois Open Source
2// License. See LICENSE.TXT for details.
3
4// abs(x) < 0 and y == Const puzzle.
5#include <cstddef>
6#include <cstdint>
7#include <cstdio>
8#include <cstdlib>
9#include <cstring>
10
11extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
12 if (Size < 8) return 0;
13 int x;
14 unsigned y;
15 memcpy(&x, Data, sizeof(x));
16 memcpy(&y, Data + sizeof(x), sizeof(y));
Vitaly Buka540d7e52018-05-25 18:27:12 +000017 volatile int abs_x = abs(x);
18 if (abs_x < 0 && y == 0xbaddcafe) {
George Karpenkov10ab2ac2017-08-21 23:25:50 +000019 printf("BINGO; Found the target, exiting; x = 0x%x y 0x%x\n", x, y);
20 fflush(stdout);
21 exit(1);
22 }
23 return 0;
24}
25