This reverts commit52aeacfbf5. There isn't full agreement on a path forward yet, but there is agreement that this shouldn't land as-is. See discussion on https://reviews.llvm.org/D105338 Also reverts unreviewed "[clang] Improve `-Wnull-dereference` diag to be more in-line with reality" This reverts commitf4877c78c0. And all the related changes to tests: This reverts commit9a0152799f. This reverts commit3f7c9cc274. This reverts commit329f8197ef. This reverts commitaa9f58cc2c. This reverts commit2df37d5ddd. This reverts commita72a441812.
28 lines
732 B
C++
28 lines
732 B
C++
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
// Simple test for a fuzzer. The fuzzer must find the string "Hi!".
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <cstdio>
|
|
|
|
static volatile int Sink;
|
|
static volatile int *Null = 0;
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
|
if (Size > 0 && Data[0] == 'H') {
|
|
Sink = 1;
|
|
if (Size > 1 && Data[1] == 'i') {
|
|
Sink = 2;
|
|
if (Size > 2 && Data[2] == '!') {
|
|
printf("Found the target, dereferencing NULL\n");
|
|
*Null = 1;
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|