Patchwork D7565: fuzz: make standalone_fuzz_target_runner call LLVMFuzzerInitialize

login
register
mail settings
Submitter phabricator
Date Dec. 6, 2019, 8:51 p.m.
Message ID <differential-rev-PHID-DREV-57j3zscwenfmhcobmnkm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43612/
State Superseded
Headers show

Comments

phabricator - Dec. 6, 2019, 8:51 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Otherwise some of our fuzzers crash when they try and use Python.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7565

AFFECTED FILES
  contrib/fuzz/standalone_fuzz_target_runner.cc

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/fuzz/standalone_fuzz_target_runner.cc b/contrib/fuzz/standalone_fuzz_target_runner.cc
--- a/contrib/fuzz/standalone_fuzz_target_runner.cc
+++ b/contrib/fuzz/standalone_fuzz_target_runner.cc
@@ -17,8 +17,12 @@ 
 // We deliberately keep this inteface simple and header-free.
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
 
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv);
+
 int main(int argc, char **argv)
 {
+	LLVMFuzzerInitialize(&argc, &argv);
+
 	for (int i = 1; i < argc; i++) {
 		std::ifstream in(argv[i]);
 		in.seekg(0, in.end);