annotate compiler-rt/test/fuzzer/DivTest.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
2 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
3 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 // Simple test for a fuzzer: find the interesting argument for div.
anatofuz
parents:
diff changeset
6 #include <assert.h>
anatofuz
parents:
diff changeset
7 #include <cstddef>
anatofuz
parents:
diff changeset
8 #include <cstdint>
anatofuz
parents:
diff changeset
9 #include <cstring>
anatofuz
parents:
diff changeset
10 #include <iostream>
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 static volatile int Sink;
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
anatofuz
parents:
diff changeset
15 if (Size < 4) return 0;
anatofuz
parents:
diff changeset
16 int a;
anatofuz
parents:
diff changeset
17 memcpy(&a, Data, 4);
anatofuz
parents:
diff changeset
18 Sink = 12345678 / (987654 - a);
anatofuz
parents:
diff changeset
19 return 0;
anatofuz
parents:
diff changeset
20 }
anatofuz
parents:
diff changeset
21