D3697: fuzz: try and generate an interesting mpatch seed from a repo

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Fri Jun 8 10:29:22 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG99ab72b867b7: fuzz: try and generate an interesting mpatch seed from a repo (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3697?vs=8988&id=8998

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

AFFECTED FILES
  contrib/fuzz/mpatch_corpus.py

CHANGE DETAILS

diff --git a/contrib/fuzz/mpatch_corpus.py b/contrib/fuzz/mpatch_corpus.py
--- a/contrib/fuzz/mpatch_corpus.py
+++ b/contrib/fuzz/mpatch_corpus.py
@@ -1,9 +1,14 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 
 import argparse
 import struct
 import zipfile
 
+from mercurial import (
+    hg,
+    ui as uimod,
+)
+
 ap = argparse.ArgumentParser()
 ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
 args = ap.parse_args()
@@ -59,6 +64,16 @@
         str(corpus('a', [delta([deltafrag(0, 20, 'b')])]))
     )
 
+    try:
+        # Generated from repo data
+        r = hg.repository(uimod.ui(), '../..')
+        fl = r.file('mercurial/manifest.py')
+        rl = getattr(fl, '_revlog', fl)
+        bins = rl._chunks(rl._deltachain(10)[0])
+        zf.writestr('manifest_py_rev_10',
+                    str(corpus(bins[0], bins[1:])))
+    except: # skip this, so no re-raises
+        print('skipping seed file from repo data')
     # Automatically discovered by running the fuzzer
     zf.writestr(
         "mpatch_decode_old_overread", "\x02\x00\x00\x00\x02\x00\x00\x00"



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


More information about the Mercurial-devel mailing list