Commit 844333aa by Bartholomew De la Villardière Committed by Victor M. Alvarez

Fix OverflowError when match is call on large data (#81)

parent 8590aca8
...@@ -15,6 +15,8 @@ limitations under the License. ...@@ -15,6 +15,8 @@ limitations under the License.
*/ */
/* headers */ /* headers */
#define PY_SSIZE_T_CLEAN
#include <Python.h> #include <Python.h>
#include "structmember.h" #include "structmember.h"
...@@ -1348,7 +1350,7 @@ static PyObject* Rules_match( ...@@ -1348,7 +1350,7 @@ static PyObject* Rules_match(
int pid = 0; int pid = 0;
int timeout = 0; int timeout = 0;
int length; Py_ssize_t length = 0;
int error = ERROR_SUCCESS; int error = ERROR_SUCCESS;
int fast_mode = 0; int fast_mode = 0;
...@@ -1468,7 +1470,7 @@ static PyObject* Rules_match( ...@@ -1468,7 +1470,7 @@ static PyObject* Rules_match(
error = yr_rules_scan_mem( error = yr_rules_scan_mem(
object->rules, object->rules,
(unsigned char*) data, (unsigned char*) data,
(unsigned int) length, (size_t) length,
fast_mode ? SCAN_FLAGS_FAST_MODE : 0, fast_mode ? SCAN_FLAGS_FAST_MODE : 0,
yara_callback, yara_callback,
&callback_data, &callback_data,
......
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