LLVM
4.0.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
llvm.src
lib
Fuzzer
test
StrncmpOOBTest.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
// Test that libFuzzer itself does not read out of bounds.
5
#include <assert.h>
6
#include <cstdint>
7
#include <cstring>
8
#include <cstdlib>
9
#include <cstddef>
10
#include <iostream>
11
12
static
volatile
int
Sink
;
13
14
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t *Data,
size_t
Size) {
15
if
(Size < 5)
return
0;
16
const
char
*Ch =
reinterpret_cast<
const
char
*
>
(Data);
17
if
(Ch[Size - 3] ==
'a'
)
18
Sink
= strncmp(Ch + Size - 3,
"abcdefg"
, 6);
19
return
0;
20
}
21
Sink
static volatile int Sink
Definition:
StrncmpOOBTest.cpp:12
LLVMFuzzerTestOneInput
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
Definition:
StrncmpOOBTest.cpp:14
Generated on Wed Mar 8 2017 17:28:47 for LLVM by
1.8.6