D7600: fuzz: add a seed corpus for the dirs fuzzer

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Dec 10 19:11:29 EST 2019


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I was hoping to trigger an asan violation under Python 3 that some internal
  tests at Google found, but for some reason that's beyond me I can't seem to
  manage.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/dirs_corpus.py

CHANGE DETAILS

diff --git a/contrib/fuzz/dirs_corpus.py b/contrib/fuzz/dirs_corpus.py
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/dirs_corpus.py
@@ -0,0 +1,29 @@
+from __future__ import absolute_import, print_function
+
+import argparse
+import zipfile
+
+ap = argparse.ArgumentParser()
+ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
+args = ap.parse_args()
+
+with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
+    zf.writestr(
+        "greek-tree",
+        "\n".join(
+            [
+                "iota",
+                "A/mu",
+                "A/B/lambda",
+                "A/B/E/alpha",
+                "A/B/E/beta",
+                "A/D/gamma",
+                "A/D/G/pi",
+                "A/D/G/rho",
+                "A/D/G/tau",
+                "A/D/H/chi",
+                "A/D/H/omega",
+                "A/D/H/psi",
+            ]
+        ),
+    )
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -62,7 +62,7 @@
 
 PARSERS_OBJS=parsers-manifest.o parsers-charencode.o parsers-parsers.o parsers-dirs.o parsers-pathencode.o parsers-revlog.o
 
-dirs_fuzzer: dirs.cc pyutil.o $(PARSERS_OBJS)
+dirs_fuzzer: dirs.cc pyutil.o $(PARSERS_OBJS) $$OUT/dirs_fuzzer_seed_corpus.zip
 	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial dirs.cc \



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


More information about the Mercurial-devel mailing list