diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/intern/bpy_driver.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index bc81eb8ee24..f6ff1b3f36b 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -253,7 +253,6 @@ static void pydriver_error(ChannelDriver *driver) #define OK_OP(op) [op] = 1 const char secure_opcodes[255] = { - OK_OP(0), OK_OP(POP_TOP), OK_OP(ROT_TWO), OK_OP(ROT_THREE), @@ -347,15 +346,14 @@ static bool bpy_driver_secure_bytecode_validate(PyObject *expr_code, PyObject *d /* Check opcodes. */ { - const char *codestr; + const _Py_CODEUNIT *codestr; Py_ssize_t code_len; PyBytes_AsStringAndSize(py_code->co_code, (char **)&codestr, &code_len); + code_len /= sizeof(*codestr); -#define CODESIZE(op) (HAS_ARG(op) ? 3 : 1) - - for (Py_ssize_t i = 0; i < code_len; i += CODESIZE(codestr[i])) { - const int opcode = codestr[i]; + for (Py_ssize_t i = 0; i < code_len; i++) { + const int opcode = _Py_OPCODE(codestr[i]); if (secure_opcodes[opcode] == 0) { fprintf(stderr, "\tBPY_driver_eval() - restructed access disallows opcode '%d', " "enable auto-execution to support\n", opcode); |