[Bf-blender-cvs] [bf6bde2] master: Fix: BGE crashes when RunPythonCallBackList() is called with maxargcount != minargcount

Sybren A. Stüvel noreply at git.blender.org
Mon Apr 20 07:55:29 CEST 2015


Commit: bf6bde232d42c3e1a41a3841292150fae3d214cc
Author: Sybren A. Stüvel
Date:   Mon Apr 20 13:53:06 2015 +0800
Branches: master
https://developer.blender.org/rBbf6bde232d42c3e1a41a3841292150fae3d214cc

Fix: BGE crashes when RunPythonCallBackList() is called with maxargcount != minargcount

===================================================================

M	source/gameengine/Expressions/KX_PythonCallBack.cpp

===================================================================

diff --git a/source/gameengine/Expressions/KX_PythonCallBack.cpp b/source/gameengine/Expressions/KX_PythonCallBack.cpp
index 946a385..1d97a8c 100644
--- a/source/gameengine/Expressions/KX_PythonCallBack.cpp
+++ b/source/gameengine/Expressions/KX_PythonCallBack.cpp
@@ -84,9 +84,8 @@ static PyObject *CreatePythonTuple(unsigned int argcount, PyObject **arglist)
 void RunPythonCallBackList(PyObject *functionlist, PyObject **arglist, unsigned int minargcount, unsigned int maxargcount)
 {
 	unsigned int size = PyList_Size(functionlist);
-	PyObject *argTuples[(maxargcount - minargcount) + 1];
-
-	argTuples[0] = NULL;
+	PyObject *argTuples[maxargcount - minargcount + 1];
+	memset(argTuples, 0, sizeof(PyObject *) * (maxargcount - minargcount + 1));
 
 	for (unsigned int i = 0; i < size; ++i) {
 		unsigned int funcargcount = 0;




More information about the Bf-blender-cvs mailing list