File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 12
12
13
13
const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
14
14
15
+ #if defined(__AFL_COMPILER)
15
16
static bool read_stdin (std::vector<uint8_t >& data)
16
17
{
17
18
uint8_t buffer[1024 ];
@@ -23,6 +24,7 @@ static bool read_stdin(std::vector<uint8_t>& data)
23
24
}
24
25
return length == 0 ;
25
26
}
27
+ #endif
26
28
27
29
// Default initialization: Override using a non-weak initialize().
28
30
__attribute__ ((weak)) void initialize()
@@ -44,9 +46,9 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
44
46
return 0 ;
45
47
}
46
48
47
- // Declare main(...) "weak" to allow for libFuzzer linking. libFuzzer provides
48
- // the main(...) function.
49
- __attribute__ ((weak)) int main(int argc, char ** argv)
49
+ // Generally, the fuzzer will provide main(), except for AFL
50
+ # if defined(__AFL_COMPILER)
51
+ int main (int argc, char ** argv)
50
52
{
51
53
initialize ();
52
54
#ifdef __AFL_INIT
@@ -74,3 +76,4 @@ __attribute__((weak)) int main(int argc, char** argv)
74
76
#endif
75
77
return 0 ;
76
78
}
79
+ #endif
You can’t perform that action at this time.
0 commit comments