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