Commit 9b4db21a by barahilia Committed by Victor M. Alvarez

Fix segfault at error in match string (#62)

If Yara return error for `rules.match(data='string')` the Python wrapper
module crashes process with a segmentation fault.
Handle properly errors from 'data' and from 'pid'.
parent c9b293ce
......@@ -1512,7 +1512,18 @@ static PyObject* Rules_match(
if (error != ERROR_CALLBACK_ERROR)
{
handle_error(error, filepath);
if (filepath != NULL)
{
handle_error(error, filepath);
}
else if (data != NULL)
{
handle_error(error, "<data>");
}
else if (pid != 0)
{
handle_error(error, "<proc>");
}
#ifdef PROFILING_ENABLED
PyObject* exception = PyErr_Occurred();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment