fuzz: add a seed corpus for the dirs fuzzer
authorAugie Fackler <augie@google.com>
Tue, 10 Dec 2019 19:04:53 -0500
changeset 43862 b7af8a02a304
parent 43861 d74d78aa74e9
child 43863 1ffbd03c8d75
fuzz: add a seed corpus for the dirs fuzzer 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. Differential Revision: https://phab.mercurial-scm.org/D7600
contrib/fuzz/Makefile
contrib/fuzz/dirs_corpus.py
--- a/contrib/fuzz/Makefile	Tue Dec 10 19:04:08 2019 -0500
+++ b/contrib/fuzz/Makefile	Tue Dec 10 19:04:53 2019 -0500
@@ -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 \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/fuzz/dirs_corpus.py	Tue Dec 10 19:04:53 2019 -0500
@@ -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",
+            ]
+        ),
+    )