Skip to content

Commit 489aec4

Browse files
committed
fuzzers: declare standalone functions
1 parent 0429894 commit 489aec4

File tree

9 files changed

+29
-2
lines changed

9 files changed

+29
-2
lines changed

fuzzers/commit_graph_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "hash.h"
1818
#include "commit_graph.h"
1919

20+
#include "standalone_driver.h"
21+
2022
int LLVMFuzzerInitialize(int *argc, char ***argv)
2123
{
2224
GIT_UNUSED(argc);

fuzzers/config_file_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "git2.h"
1111
#include "config_backend.h"
1212

13+
#include "standalone_driver.h"
14+
1315
#define UNUSED(x) (void)(x)
1416

1517
int foreach_cb(const git_config_entry *entry, void *payload)

fuzzers/download_refs_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "git2/sys/transport.h"
1616
#include "futils.h"
1717

18+
#include "standalone_driver.h"
19+
1820
#define UNUSED(x) (void)(x)
1921

2022
struct fuzzer_buffer {

fuzzers/midx_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "hash.h"
1717
#include "midx.h"
1818

19+
#include "standalone_driver.h"
20+
1921
int LLVMFuzzerInitialize(int *argc, char ***argv)
2022
{
2123
GIT_UNUSED(argc);

fuzzers/objects_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "git2.h"
1111
#include "object.h"
1212

13+
#include "standalone_driver.h"
14+
1315
#define UNUSED(x) (void)(x)
1416

1517
int LLVMFuzzerInitialize(int *argc, char ***argv)

fuzzers/packfile_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "common.h"
1515
#include "str.h"
1616

17+
#include "standalone_driver.h"
18+
1719
static git_odb *odb = NULL;
1820
static git_odb_backend *mempack = NULL;
1921

fuzzers/patch_parse_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "patch.h"
1212
#include "patch_parse.h"
1313

14+
#include "standalone_driver.h"
15+
1416
#define UNUSED(x) (void)(x)
1517

1618
int LLVMFuzzerInitialize(int *argc, char ***argv)

fuzzers/standalone_driver.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include "futils.h"
1212
#include "path.h"
1313

14-
extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
15-
extern int LLVMFuzzerInitialize(int *argc, char ***argv);
14+
#include "standalone_driver.h"
1615

1716
static int run_one_file(const char *filename)
1817
{

fuzzers/standalone_driver.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (C) the libgit2 contributors. All rights reserved.
3+
*
4+
* This file is part of libgit2, distributed under the GNU GPL v2 with
5+
* a Linking Exception. For full terms see the included COPYING file.
6+
*/
7+
8+
#ifndef INCLUDE_standalone_driver_h__
9+
#define INCLUDE_standalone_driver_h__
10+
11+
extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
12+
extern int LLVMFuzzerInitialize(int *argc, char ***argv);
13+
14+
#endif

0 commit comments

Comments
 (0)