[Bf-blender-cvs] [1140238] master: Fix T45976: Crash accessing BMesh customdata

Campbell Barton noreply at git.blender.org
Tue Sep 1 12:04:23 CEST 2015


Commit: 1140238acf31fba54e3a88b9519c8e8b46b19d59
Author: Campbell Barton
Date:   Tue Sep 1 19:57:48 2015 +1000
Branches: master
https://developer.blender.org/rB1140238acf31fba54e3a88b9519c8e8b46b19d59

Fix T45976: Crash accessing BMesh customdata

Layers returned from items() and values() could have an invalid index.

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

M	source/blender/python/bmesh/bmesh_py_types_customdata.c

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

diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 3adf37f..5addc4c 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -490,7 +490,7 @@ static PyObject *bpy_bmlayercollection_items(BPy_BMLayerCollection *self)
 		item = PyTuple_New(2);
 		PyTuple_SET_ITEMS(item,
 		        PyUnicode_FromString(data->layers[index].name),
-		        BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index));
+		        BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, i));
 		PyList_SET_ITEM(ret, i++, item);
 	}
 
@@ -523,7 +523,7 @@ static PyObject *bpy_bmlayercollection_values(BPy_BMLayerCollection *self)
 	ret = PyList_New(tot);
 
 	for (i = 0; tot-- > 0; index++) {
-		item = BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+		item = BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, i);
 		PyList_SET_ITEM(ret, i++, item);
 	}




More information about the Bf-blender-cvs mailing list