aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-04-17 10:26:33 +0200
committerGitHub <noreply@github.com>2023-04-17 10:26:33 +0200
commita326c23210dc2ace37bf1cadcc4521cf5d0b58cb (patch)
tree5e97dc274212181cd0117057492bce84809e1a4d /utils
parent4f2d9eeaaa6b702ef28eb883f9000321eaf1fe9b (diff)
parent7f734c96d187312868178e8ead95dc103c557c1f (diff)
downloadafl++-a326c23210dc2ace37bf1cadcc4521cf5d0b58cb.tar.gz
Merge pull request #1706 from AFLplusplus/dev4.06c
push to stable, 4.06c release
Diffstat (limited to 'utils')
-rw-r--r--utils/aflpp_driver/aflpp_driver.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c
index ec304c8c..4e8f466d 100644
--- a/utils/aflpp_driver/aflpp_driver.c
+++ b/utils/aflpp_driver/aflpp_driver.c
@@ -33,6 +33,11 @@ $ afl-fuzz -i in -o out -- ./test_fuzzer
*/
+#ifdef __cplusplus
+extern "C" {
+
+#endif
+
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
@@ -69,11 +74,14 @@ extern unsigned char *__afl_area_ptr;
extern unsigned int __afl_map_size;
// libFuzzer interface is thin, so we don't include any libFuzzer headers.
-__attribute__((weak)) int LLVMFuzzerTestOneInput(const uint8_t *Data,
- size_t Size);
-__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv);
-__attribute__((weak)) int LLVMFuzzerRunDriver(
- int *argc, char ***argv, int (*callback)(const uint8_t *data, size_t size));
+/* Using the weak attributed on LLVMFuzzerTestOneInput() breaks oss-fuzz but
+ on the other hand this is what Google needs to make LLVMFuzzerRunDriver()
+ work. Choose your poison Google! */
+/*__attribute__((weak))*/ int LLVMFuzzerTestOneInput(const uint8_t *Data,
+ size_t Size);
+__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv);
+__attribute__((weak)) int LLVMFuzzerRunDriver(
+ int *argc, char ***argv, int (*callback)(const uint8_t *data, size_t size));
// Default nop ASan hooks for manual poisoning when not linking the ASan
// runtime
@@ -260,6 +268,17 @@ static int ExecuteFilesOnyByOne(int argc, char **argv,
__attribute__((weak)) int main(int argc, char **argv) {
+ // Enable if LLVMFuzzerTestOneInput() has the weak attribute
+ /*
+ if (!LLVMFuzzerTestOneInput) {
+
+ fprintf(stderr, "Error: function LLVMFuzzerTestOneInput() not found!\n");
+ abort();
+
+ }
+
+ */
+
if (argc < 2 || strncmp(argv[1], "-h", 2) == 0)
printf(
"============================== INFO ================================\n"
@@ -409,3 +428,9 @@ __attribute__((weak)) int LLVMFuzzerRunDriver(
}
+#ifdef __cplusplus
+
+}
+
+#endif
+