From 4a3e00488d27b4a568de4fdaa44b076b24c04abd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Nov 2010 07:42:14 +0000 Subject: fix for own recent error, [#24695] column_vector_multiplication call writes past end of array was setting the vector array out of bounds with vec*=matrix, where the vector wasnt size 4. --- source/blender/python/generic/mathutils_vector.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/python') diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index 64f7eb6634b..e4027d7a80e 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -1145,11 +1145,14 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2) /* only support vec*=float and vec*=mat vec*=vec result is a float so that wont work */ if (MatrixObject_Check(v2)) { + float rvec[MAX_DIMENSIONS]; if(!BaseMath_ReadCallback((MatrixObject *)v2)) return NULL; - if(column_vector_multiplication(vec->vec, vec, (MatrixObject*)v2) == -1) + if(column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1) return NULL; + + memcpy(vec->vec, rvec, sizeof(float) * vec->size); } else if (QuaternionObject_Check(v2)) { /* VEC *= QUAT */ -- cgit v1.2.3