diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-01 21:38:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-01 21:38:33 +0300 |
commit | 7fe3ab7e8e23fb8750eead8f53802928b734821c (patch) | |
tree | 41bc8c662f3903e0d50c8fa61805306c6142ec5d | |
parent | 46b0e90cf68cbc983afdabc4ea8572fc5a6938a2 (diff) |
bugfix for reading invalid id prop lengths from python.
-rw-r--r-- | source/blender/python/generic/IDProp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index b3679c8f4a2..4d52e184319 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -480,10 +480,13 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop) IDProperty *loop; int i; - for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) + for (i=0, loop=prop->data.group.first; loop && (i < prop->len); loop=loop->next, i++) PyList_SET_ITEM(seq, i, PyUnicode_FromString(loop->name)); - if (i != prop->len) { + /* if the id prop is corrupt, count the remaining */ + for (; loop; loop=loop->next, i++) {} + + if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */ BPy_IDGroup_CorrectListLen(prop, seq, i); Py_DECREF(seq); /*free the list*/ /*call self again*/ |