From bc8364fef030d95f27cff5ae6e068cc78bd1abd5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Jul 2008 13:21:37 +0000 Subject: [PATCH] bugfix, ActionActuator was missing many checks for PyArg_ParseTuple failing. This meant an error in a script could be reported in a different line or script file which makes it quite hard to trace the problem. There were also places where invalid pointers could be used because of this. The whole game engine pyapi probably needs to have these checks added. --- .../Converter/BL_ActionActuator.cpp | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 5050da3fe7f..44f6ec1af90 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -641,6 +641,9 @@ PyObject* BL_ActionActuator::PySetAction(PyObject* self, m_blendframe = 0; } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -660,6 +663,9 @@ PyObject* BL_ActionActuator::PySetStart(PyObject* self, { m_startframe = start; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -679,6 +685,9 @@ PyObject* BL_ActionActuator::PySetEnd(PyObject* self, { m_endframe = end; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -699,6 +708,9 @@ PyObject* BL_ActionActuator::PySetBlendin(PyObject* self, { m_blendin = blendin; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -724,6 +736,9 @@ PyObject* BL_ActionActuator::PySetBlendtime(PyObject* self, if (m_blendframe>m_blendin) m_blendframe = m_blendin; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -745,6 +760,9 @@ PyObject* BL_ActionActuator::PySetPriority(PyObject* self, { m_priority = priority; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -768,6 +786,9 @@ PyObject* BL_ActionActuator::PySetFrame(PyObject* self, else if (m_localtime>m_endframe) m_localtime=m_endframe; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -788,6 +809,9 @@ PyObject* BL_ActionActuator::PySetProperty(PyObject* self, { m_propname = string; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -807,6 +831,9 @@ PyObject* BL_ActionActuator::PySetFrameProperty(PyObject* self, { m_framepropname = string; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -822,6 +849,9 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* self, { m_propname = string; } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; @@ -846,7 +876,8 @@ PyObject* BL_ActionActuator::PySetChannel(PyObject* self, int row,col; int mode = 0; /* 0 for bone space, 1 for armature/world space */ - PyArg_ParseTuple(args,"sO|i", &string, &pylist, &mode); + if (!PyArg_ParseTuple(args,"sO|i", &string, &pylist, &mode)) + return NULL; if (pylist->ob_type == &CListValue::Type) {