Fix T45976: Crash accessing BMesh customdata

Layers returned from items() and values() could have an invalid index.
This commit is contained in:
Campbell Barton 2015-09-01 19:57:48 +10:00
parent 55f87590f0
commit 1140238acf
Notes: blender-bot 2023-02-14 08:42:47 +01:00
Referenced by issue #45976, Shape key data in bmesh is wrong; access causes Windows-specific crashes
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}