Use PyC_ParseBool to parse bools

This could cause problems since they could be any int,
then passed directly to internal functions that assume bools.
This commit is contained in:
2015-08-04 18:34:20 +10:00
parent 62c8f46ab6
commit cff288cf3a
9 changed files with 130 additions and 74 deletions

View File

@@ -45,6 +45,7 @@
#include "bpy_rna.h" /* for setting arg props only - pyrna_py_to_prop() */
#include "bpy_util.h"
#include "../generic/bpy_internal_import.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "RNA_access.h"
@@ -311,8 +312,8 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
const char *opname;
PyObject *kw = NULL; /* optional args */
int all_args = 1;
int macro_args = 1;
bool all_args = true;
bool macro_args = true;
int error_val = 0;
char *buf = NULL;
@@ -325,8 +326,14 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
if (!PyArg_ParseTuple(args, "s|O!ii:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args, &macro_args))
if (!PyArg_ParseTuple(
args, "s|O!O&O&:_bpy.ops.as_string",
&opname, &PyDict_Type, &kw,
PyC_ParseBool, &all_args,
PyC_ParseBool, &macro_args))
{
return NULL;
}
ot = WM_operatortype_find(opname, true);