[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26525] trunk/blender/source/blender/ python/generic/IDProp.c: bugfix for reading invalid id prop lengths from python.
Campbell Barton
ideasman42 at gmail.com
Mon Feb 1 19:38:33 CET 2010
Revision: 26525
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26525
Author: campbellbarton
Date: 2010-02-01 19:38:33 +0100 (Mon, 01 Feb 2010)
Log Message:
-----------
bugfix for reading invalid id prop lengths from python.
Modified Paths:
--------------
trunk/blender/source/blender/python/generic/IDProp.c
Modified: trunk/blender/source/blender/python/generic/IDProp.c
===================================================================
--- trunk/blender/source/blender/python/generic/IDProp.c 2010-02-01 18:30:00 UTC (rev 26524)
+++ trunk/blender/source/blender/python/generic/IDProp.c 2010-02-01 18:38:33 UTC (rev 26525)
@@ -480,10 +480,13 @@
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*/
More information about the Bf-blender-cvs
mailing list