##// END OF EJS Templates
fuzz: report error if Python code raised exception...
Yuya Nishihara -
r40136:ca4a32d0 default
parent child Browse files
Show More
@@ -47,8 +47,8 b' int LLVMFuzzerTestOneInput(const uint8_t'
47 PyCodeObject *code =
47 PyCodeObject *code =
48 (PyCodeObject *)Py_CompileString(R"py(
48 (PyCodeObject *)Py_CompileString(R"py(
49 from parsers import lazymanifest
49 from parsers import lazymanifest
50 try:
50 lm = lazymanifest(mdata)
51 lm = lazymanifest(mdata)
51 try:
52 # iterate the whole thing, which causes the code to fully parse
52 # iterate the whole thing, which causes the code to fully parse
53 # every line in the manifest
53 # every line in the manifest
54 list(lm.iterentries())
54 list(lm.iterentries())
@@ -65,7 +65,11 b' except Exception as e:'
65 # print e
65 # print e
66 )py",
66 )py",
67 "fuzzer", Py_file_input);
67 "fuzzer", Py_file_input);
68 PyEval_EvalCode(code, globals, locals);
68 PyObject *res = PyEval_EvalCode(code, globals, locals);
69 if (!res) {
70 PyErr_Print();
71 }
72 Py_XDECREF(res);
69 Py_DECREF(code);
73 Py_DECREF(code);
70 Py_DECREF(locals);
74 Py_DECREF(locals);
71 Py_DECREF(mtext);
75 Py_DECREF(mtext);
General Comments 0
You need to be logged in to leave comments. Login now