##// END OF EJS Templates
tests: use inline Python for revlog test...
Gregory Szorc -
r39316:da459d42 default
parent child Browse files
Show More
@@ -1,47 +1,52 b''
1 1 $ hg init empty-repo
2 2 $ cd empty-repo
3 3
4 4 Flags on revlog version 0 are rejected
5 5
6 6 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
7 7 ... fh.write(b'\x00\x01\x00\x00') and None
8 8
9 9 $ hg log
10 10 abort: unknown flags (0x01) in version 0 revlog 00changelog.i!
11 11 [255]
12 12
13 13 Unknown flags on revlog version 1 are rejected
14 14
15 15 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
16 16 ... fh.write(b'\x00\x04\x00\x01') and None
17 17
18 18 $ hg log
19 19 abort: unknown flags (0x04) in version 1 revlog 00changelog.i!
20 20 [255]
21 21
22 22 Unknown version is rejected
23 23
24 24 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
25 25 ... fh.write(b'\x00\x00\x00\x02') and None
26 26
27 27 $ hg log
28 28 abort: unknown version (2) in revlog 00changelog.i!
29 29 [255]
30 30
31 31 $ cd ..
32 32
33 33 Test for CVE-2016-3630
34 34
35 35 $ hg init
36 36
37 37 >>> open("a.i", "wb").write(
38 38 ... b"""eJxjYGZgZIAAYQYGxhgom+k/FMx8YKx9ZUaKSOyqo4cnuKb8mbqHV5cBCVTMWb1Cwqkhe4Gsg9AD
39 39 ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA=="""
40 40 ... .decode("base64").decode("zlib"))
41 41
42 42 $ hg debugindex a.i
43 43 rev linkrev nodeid p1 p2
44 44 0 2 99e0332bd498 000000000000 000000000000
45 45 1 3 6674f57a23d8 99e0332bd498 000000000000
46 $ hg debugdata a.i 1 2>&1 | egrep 'Error:.*decoded'
47 (mercurial\.\w+\.mpatch\.)?mpatchError: patch cannot be decoded (re)
46
47 >>> from mercurial import revlog, vfs
48 >>> tvfs = vfs.vfs(b'.')
49 >>> tvfs.options = {b'revlogv1': True}
50 >>> rl = revlog.revlog(tvfs, b'a.i')
51 >>> rl.revision(1)
52 mpatchError('patch cannot be decoded',)
General Comments 0
You need to be logged in to leave comments. Login now