File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 29
29
#include < utility>
30
30
#include < vector>
31
31
32
+ #ifdef __AFL_FUZZ_INIT
33
+ __AFL_FUZZ_INIT ();
34
+ #endif
35
+
32
36
const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
33
37
34
38
/* *
@@ -188,7 +192,7 @@ int main(int argc, char** argv)
188
192
{
189
193
initialize ();
190
194
static const auto & test_one_input = *Assert (g_test_one_input);
191
- #ifdef __AFL_INIT
195
+ #ifdef __AFL_HAVE_MANUAL_CONTROL
192
196
// Enable AFL deferred forkserver mode. Requires compilation using
193
197
// afl-clang-fast++. See fuzzing.md for details.
194
198
__AFL_INIT ();
@@ -197,12 +201,10 @@ int main(int argc, char** argv)
197
201
#ifdef __AFL_LOOP
198
202
// Enable AFL persistent mode. Requires compilation using afl-clang-fast++.
199
203
// See fuzzing.md for details.
204
+ const uint8_t * buffer = __AFL_FUZZ_TESTCASE_BUF;
200
205
while (__AFL_LOOP (1000 )) {
201
- std::vector<uint8_t > buffer;
202
- if (!read_stdin (buffer)) {
203
- continue ;
204
- }
205
- test_one_input (buffer);
206
+ size_t buffer_len = __AFL_FUZZ_TESTCASE_LEN;
207
+ test_one_input ({buffer, buffer_len});
206
208
}
207
209
#else
208
210
std::vector<uint8_t > buffer;
You can’t perform that action at this time.
0 commit comments