LLVM
4.0.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
llvm.src
lib
Fuzzer
test
LoadTest.cpp
Go to the documentation of this file.
1
// This file is distributed under the University of Illinois Open Source
2
// License. See LICENSE.TXT for details.
3
4
// Simple test for a fuzzer: find interesting value of array index.
5
#include <assert.h>
6
#include <cstdint>
7
#include <cstring>
8
#include <cstddef>
9
#include <iostream>
10
11
static
volatile
int
Sink
;
12
const
int
kArraySize
= 1234567;
13
int
array
[
kArraySize
];
14
15
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t *Data,
size_t
Size) {
16
if
(Size < 8)
return
0;
17
size_t
a = 0;
18
memcpy(&a, Data, 8);
19
Sink
=
array
[a % (
kArraySize
+ 1)];
20
return
0;
21
}
22
Sink
static volatile int Sink
Definition:
LoadTest.cpp:11
kArraySize
const int kArraySize
Definition:
LoadTest.cpp:12
array
int array[kArraySize]
Definition:
LoadTest.cpp:13
LLVMFuzzerTestOneInput
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
Definition:
LoadTest.cpp:15
Generated on Wed Mar 8 2017 17:13:00 for LLVM by
1.8.6