Commit 72942fc1 by Victor M. Alvarez

Fix multi-threading issue

yara_callback was invoking Python's code without acquiring the global interpreter lock.
parent f124096d
......@@ -429,11 +429,12 @@ int yara_callback(
if (message == CALLBACK_MSG_RULE_NOT_MATCHING && callback == NULL)
return CALLBACK_CONTINUE;
if (message == CALLBACK_MSG_IMPORT_MODULE && modules_data == NULL)
return CALLBACK_CONTINUE
if (message == CALLBACK_MSG_IMPORT_MODULE)
{
if (modules_data == NULL)
return CALLBACK_CONTINUE;
gil_state = PyGILState_Ensure();
module_import = (YR_MODULE_IMPORT*) message_data;
module_data = PyDict_GetItemString(
......@@ -461,6 +462,7 @@ int yara_callback(
module_import->module_data_size = data_size;
}
PyGILState_Release(gil_state);
return CALLBACK_CONTINUE;
}
......
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