##// END OF EJS Templates
fuzz: try and generate an interesting mpatch seed from a repo...
Augie Fackler -
r38266:99ab72b8 @33 default
parent child Browse files
Show More
@@ -1,9 +1,14 b''
1 from __future__ import absolute_import
1 from __future__ import absolute_import, print_function
2
2
3 import argparse
3 import argparse
4 import struct
4 import struct
5 import zipfile
5 import zipfile
6
6
7 from mercurial import (
8 hg,
9 ui as uimod,
10 )
11
7 ap = argparse.ArgumentParser()
12 ap = argparse.ArgumentParser()
8 ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
13 ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
9 args = ap.parse_args()
14 args = ap.parse_args()
@@ -59,6 +64,16 b' with zipfile.ZipFile(args.out[0], "w", z'
59 str(corpus('a', [delta([deltafrag(0, 20, 'b')])]))
64 str(corpus('a', [delta([deltafrag(0, 20, 'b')])]))
60 )
65 )
61
66
67 try:
68 # Generated from repo data
69 r = hg.repository(uimod.ui(), '../..')
70 fl = r.file('mercurial/manifest.py')
71 rl = getattr(fl, '_revlog', fl)
72 bins = rl._chunks(rl._deltachain(10)[0])
73 zf.writestr('manifest_py_rev_10',
74 str(corpus(bins[0], bins[1:])))
75 except: # skip this, so no re-raises
76 print('skipping seed file from repo data')
62 # Automatically discovered by running the fuzzer
77 # Automatically discovered by running the fuzzer
63 zf.writestr(
78 zf.writestr(
64 "mpatch_decode_old_overread", "\x02\x00\x00\x00\x02\x00\x00\x00"
79 "mpatch_decode_old_overread", "\x02\x00\x00\x00\x02\x00\x00\x00"
General Comments 0
You need to be logged in to leave comments. Login now