summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-11-11 12:33:14 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2021-11-11 17:11:25 -0500
commit489aec44477181afa05db41bfd04bb0febe83f59 (patch)
treee39fb2dc18198a307fddf0f72c6965a200e4c4e4
parent0429894e0bd1eee077e07b22528d569c8636d6f1 (diff)
downloadlibgit2-489aec44477181afa05db41bfd04bb0febe83f59.tar.gz
fuzzers: declare standalone functions
-rw-r--r--fuzzers/commit_graph_fuzzer.c2
-rw-r--r--fuzzers/config_file_fuzzer.c2
-rw-r--r--fuzzers/download_refs_fuzzer.c2
-rw-r--r--fuzzers/midx_fuzzer.c2
-rw-r--r--fuzzers/objects_fuzzer.c2
-rw-r--r--fuzzers/packfile_fuzzer.c2
-rw-r--r--fuzzers/patch_parse_fuzzer.c2
-rw-r--r--fuzzers/standalone_driver.c3
-rw-r--r--fuzzers/standalone_driver.h14
9 files changed, 29 insertions, 2 deletions
diff --git a/fuzzers/commit_graph_fuzzer.c b/fuzzers/commit_graph_fuzzer.c
index 05783a259..1c46d78c7 100644
--- a/fuzzers/commit_graph_fuzzer.c
+++ b/fuzzers/commit_graph_fuzzer.c
@@ -17,6 +17,8 @@
#include "hash.h"
#include "commit_graph.h"
+#include "standalone_driver.h"
+
int LLVMFuzzerInitialize(int *argc, char ***argv)
{
GIT_UNUSED(argc);
diff --git a/fuzzers/config_file_fuzzer.c b/fuzzers/config_file_fuzzer.c
index 526c93928..582d74aff 100644
--- a/fuzzers/config_file_fuzzer.c
+++ b/fuzzers/config_file_fuzzer.c
@@ -10,6 +10,8 @@
#include "git2.h"
#include "config_backend.h"
+#include "standalone_driver.h"
+
#define UNUSED(x) (void)(x)
int foreach_cb(const git_config_entry *entry, void *payload)
diff --git a/fuzzers/download_refs_fuzzer.c b/fuzzers/download_refs_fuzzer.c
index c5726cba1..bdaa6aab6 100644
--- a/fuzzers/download_refs_fuzzer.c
+++ b/fuzzers/download_refs_fuzzer.c
@@ -15,6 +15,8 @@
#include "git2/sys/transport.h"
#include "futils.h"
+#include "standalone_driver.h"
+
#define UNUSED(x) (void)(x)
struct fuzzer_buffer {
diff --git a/fuzzers/midx_fuzzer.c b/fuzzers/midx_fuzzer.c
index 3cd609063..4c3124e47 100644
--- a/fuzzers/midx_fuzzer.c
+++ b/fuzzers/midx_fuzzer.c
@@ -16,6 +16,8 @@
#include "hash.h"
#include "midx.h"
+#include "standalone_driver.h"
+
int LLVMFuzzerInitialize(int *argc, char ***argv)
{
GIT_UNUSED(argc);
diff --git a/fuzzers/objects_fuzzer.c b/fuzzers/objects_fuzzer.c
index 1feff778d..51b4a1ed4 100644
--- a/fuzzers/objects_fuzzer.c
+++ b/fuzzers/objects_fuzzer.c
@@ -10,6 +10,8 @@
#include "git2.h"
#include "object.h"
+#include "standalone_driver.h"
+
#define UNUSED(x) (void)(x)
int LLVMFuzzerInitialize(int *argc, char ***argv)
diff --git a/fuzzers/packfile_fuzzer.c b/fuzzers/packfile_fuzzer.c
index f739b9563..8667cb9c5 100644
--- a/fuzzers/packfile_fuzzer.c
+++ b/fuzzers/packfile_fuzzer.c
@@ -14,6 +14,8 @@
#include "common.h"
#include "str.h"
+#include "standalone_driver.h"
+
static git_odb *odb = NULL;
static git_odb_backend *mempack = NULL;
diff --git a/fuzzers/patch_parse_fuzzer.c b/fuzzers/patch_parse_fuzzer.c
index a9b02ad4d..2e65a01fd 100644
--- a/fuzzers/patch_parse_fuzzer.c
+++ b/fuzzers/patch_parse_fuzzer.c
@@ -11,6 +11,8 @@
#include "patch.h"
#include "patch_parse.h"
+#include "standalone_driver.h"
+
#define UNUSED(x) (void)(x)
int LLVMFuzzerInitialize(int *argc, char ***argv)
diff --git a/fuzzers/standalone_driver.c b/fuzzers/standalone_driver.c
index c29102e65..cd4f71751 100644
--- a/fuzzers/standalone_driver.c
+++ b/fuzzers/standalone_driver.c
@@ -11,8 +11,7 @@
#include "futils.h"
#include "path.h"
-extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
-extern int LLVMFuzzerInitialize(int *argc, char ***argv);
+#include "standalone_driver.h"
static int run_one_file(const char *filename)
{
diff --git a/fuzzers/standalone_driver.h b/fuzzers/standalone_driver.h
new file mode 100644
index 000000000..507fcb9fd
--- /dev/null
+++ b/fuzzers/standalone_driver.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#ifndef INCLUDE_standalone_driver_h__
+#define INCLUDE_standalone_driver_h__
+
+extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
+extern int LLVMFuzzerInitialize(int *argc, char ***argv);
+
+#endif