Show More
@@ -3,6 +3,7 b'' | |||
|
3 | 3 | #include <stdlib.h> |
|
4 | 4 | #include <unistd.h> |
|
5 | 5 | |
|
6 | #include "FuzzedDataProvider.h" | |
|
6 | 7 | #include "pyutil.h" |
|
7 | 8 | |
|
8 | 9 | #include <string> |
@@ -24,7 +25,7 b' try:' | |||
|
24 | 25 | lm[e] |
|
25 | 26 | e in lm |
|
26 | 27 | (e + 'nope') in lm |
|
27 |
lm[b'xyzzy'] = (b'\0' * |
|
|
28 | lm[b'xyzzy'] = (b'\0' * nlen, 'x') | |
|
28 | 29 | # do an insert, text should change |
|
29 | 30 | assert lm.text() != mdata, "insert should change text and didn't: %r %r" % (lm.text(), mdata) |
|
30 | 31 | cloned = lm.filtercopy(lambda x: x != 'xyzzy') |
@@ -51,10 +52,14 b' int LLVMFuzzerTestOneInput(const uint8_t' | |||
|
51 | 52 | if (Size > 100000) { |
|
52 | 53 | return 0; |
|
53 | 54 | } |
|
55 | FuzzedDataProvider provider(Data, Size); | |
|
56 | Py_ssize_t nodelength = provider.ConsumeBool() ? 20 : 32; | |
|
57 | PyObject *nlen = PyLong_FromSsize_t(nodelength); | |
|
54 | 58 | PyObject *mtext = |
|
55 | 59 | PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size); |
|
56 | 60 | PyObject *locals = PyDict_New(); |
|
57 | 61 | PyDict_SetItemString(locals, "mdata", mtext); |
|
62 | PyDict_SetItemString(locals, "nlen", nlen); | |
|
58 | 63 | PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals); |
|
59 | 64 | if (!res) { |
|
60 | 65 | PyErr_Print(); |
@@ -10,7 +10,7 b' args = ap.parse_args()' | |||
|
10 | 10 | with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf: |
|
11 | 11 | zf.writestr( |
|
12 | 12 | "manifest_zero", |
|
13 | '''PKG-INFO\09b3ed8f2b81095a13064402e930565f083346e9a | |
|
13 | '''\0PKG-INFO\09b3ed8f2b81095a13064402e930565f083346e9a | |
|
14 | 14 | README\080b6e76643dcb44d4bc729e932fc464b3e36dbe3 |
|
15 | 15 | hg\0b6444347c629cc058d478023905cfb83b7f5bb9d |
|
16 | 16 | mercurial/__init__.py\0b80de5d138758541c5f05265ad144ab9fa86d1db |
@@ -25,9 +25,14 b' setup.py\\0ccf3f6daf0f13101ca73631f7a1769' | |||
|
25 | 25 | tkmerge\03c922edb43a9c143682f7bc7b00f98b3c756ebe7 |
|
26 | 26 | ''', |
|
27 | 27 | ) |
|
28 | zf.writestr("badmanifest_shorthashes", "narf\0aa\nnarf2\0aaa\n") | |
|
28 | zf.writestr("badmanifest_shorthashes", "\0narf\0aa\nnarf2\0aaa\n") | |
|
29 | 29 | zf.writestr( |
|
30 | 30 | "badmanifest_nonull", |
|
31 | "narf\0cccccccccccccccccccccccccccccccccccccccc\n" | |
|
31 | "\0narf\0cccccccccccccccccccccccccccccccccccccccc\n" | |
|
32 | 32 | "narf2aaaaaaaaaaaaaaaaaaaa\n", |
|
33 | 33 | ) |
|
34 | ||
|
35 | zf.writestr( | |
|
36 | "manifest_long_nodes", | |
|
37 | "\1a\0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n", | |
|
38 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now