Mercurial > hg
changeset 43809:51a99e09c54b
fuzz: always define LLVMFuzzerInitialize() even if we don't need it
This will make it easier to test our fuzzers outside oss-fuzz.
Differential Revision: https://phab.mercurial-scm.org/D7560
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 06 Dec 2019 15:05:34 -0500 |
parents | 54a6846ba96f |
children | 53f582bee3d1 |
files | contrib/fuzz/bdiff.cc contrib/fuzz/mpatch.cc contrib/fuzz/xdiff.cc |
diffstat | 3 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/fuzz/bdiff.cc Fri Dec 06 15:06:10 2019 -0500 +++ b/contrib/fuzz/bdiff.cc Fri Dec 06 15:05:34 2019 -0500 @@ -14,6 +14,11 @@ extern "C" { #include "bdiff.h" +extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} + int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { FuzzedDataProvider provider(Data, Size);
--- a/contrib/fuzz/mpatch.cc Fri Dec 06 15:06:10 2019 -0500 +++ b/contrib/fuzz/mpatch.cc Fri Dec 06 15:05:34 2019 -0500 @@ -14,6 +14,11 @@ #include "fuzzutil.h" +extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} + // To avoid having too many OOMs from the fuzzer infrastructure, we'll // skip patch application if the resulting fulltext would be bigger // than 10MiB.
--- a/contrib/fuzz/xdiff.cc Fri Dec 06 15:06:10 2019 -0500 +++ b/contrib/fuzz/xdiff.cc Fri Dec 06 15:05:34 2019 -0500 @@ -14,6 +14,11 @@ extern "C" { +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} + int hunk_consumer(long a1, long a2, long b1, long b2, void *priv) { // TODO: probably also test returning -1 from this when things break?