Bugfix #21212: Segfault when object.add_vertex_to_group() called with invalid vertex index

Safety checks are now performed before indexing into the dvert array obtained.
This commit is contained in:
Joshua Leung
2010-04-05 07:16:22 +00:00
parent 747b985824
commit 8599c4507b

View File

@@ -284,7 +284,11 @@ void ED_vgroup_nr_vert_add(Object *ob, int def_nr, int vertnum, float weight, in
if(dv==NULL)
return;
dv+= vertnum;
/* check that vertnum is valid before trying to get the relevant dvert */
if ((vertnum < 0) || (vertnum >= tot))
return;
else
dv += vertnum;
/* Lets first check to see if this vert is
* already in the weight group -- if so