LLVM
4.0.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
llvm.src
lib
Fuzzer
test
TraceMallocTest.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
// Tests -trace_malloc
5
#include <assert.h>
6
#include <cstdint>
7
#include <cstdlib>
8
#include <cstddef>
9
#include <iostream>
10
11
int
*
Ptr
;
12
13
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t *Data,
size_t
Size) {
14
if
(!Size)
return
0;
15
if
(*Data == 1) {
16
delete
Ptr
;
17
Ptr
=
nullptr
;
18
}
else
if
(*Data == 2) {
19
delete
Ptr
;
20
Ptr
=
new
int;
21
}
else
if
(*Data == 3) {
22
if
(!
Ptr
)
23
Ptr
=
new
int;
24
}
25
return
0;
26
}
27
LLVMFuzzerTestOneInput
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
Definition:
TraceMallocTest.cpp:13
Ptr
int * Ptr
Definition:
TraceMallocTest.cpp:11
Generated on Wed Mar 8 2017 17:29:52 for LLVM by
1.8.6