diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-04-05 11:16:22 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-04-05 11:16:22 +0400 |
commit | 8599c4507b58b2946135df91c688110e15d40404 (patch) | |
tree | 3bb172b6bf984b8d403c94d6f07a277f291b442d /source/blender/editors/object/object_vgroup.c | |
parent | 747b98582482bb447cad03bc9ffc52a1c50440e2 (diff) |
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.
Diffstat (limited to 'source/blender/editors/object/object_vgroup.c')
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 6c9b45a63cd..b086c47d6a6 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -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 |