Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
6de9d403
Commit
6de9d403
authored
Dec 25, 2016
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
fixed AFL driver to also read binary data
parent
dbdcb3fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
fuzzer-driver_afl.cpp
test/src/fuzzer-driver_afl.cpp
+12
-7
No files found.
test/src/fuzzer-driver_afl.cpp
View file @
6de9d403
...
@@ -11,9 +11,9 @@ passed byte array.
...
@@ -11,9 +11,9 @@ passed byte array.
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
*/
*/
#include <
sstream>
#include <
vector> // for vector
#include <cstdint>
#include <cstdint>
// for uint8_t
#include <iostream>
#include <iostream>
// for cin
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
);
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
);
...
@@ -23,10 +23,15 @@ int main()
...
@@ -23,10 +23,15 @@ int main()
while
(
__AFL_LOOP
(
1000
))
while
(
__AFL_LOOP
(
1000
))
{
{
#endif
#endif
// copy stdin to stringstream to pass it to fuzzer as byte array
// copy stdin to byte vector
std
::
stringstream
ss
;
std
::
vector
<
uint8_t
>
vec
;
ss
<<
std
::
cin
.
rdbuf
();
char
c
;
LLVMFuzzerTestOneInput
(
reinterpret_cast
<
const
uint8_t
*>
(
ss
.
str
().
c_str
()),
ss
.
str
().
size
());
while
(
std
::
cin
.
get
(
c
))
{
vec
.
push_back
(
static_cast
<
uint8_t
>
(
c
));
}
LLVMFuzzerTestOneInput
(
vec
.
data
(),
vec
.
size
());
#ifdef __AFL_HAVE_MANUAL_CONTROL
#ifdef __AFL_HAVE_MANUAL_CONTROL
}
}
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment