[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28003] trunk/blender/source/blender/ editors/object/object_vgroup.c: Bugfix #21212: Segfault when object. add_vertex_to_group() called with invalid vertex index

Joshua Leung aligorith at gmail.com
Mon Apr 5 09:16:22 CEST 2010


Revision: 28003
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28003
Author:   aligorith
Date:     2010-04-05 09:16:22 +0200 (Mon, 05 Apr 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_vgroup.c

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c	2010-04-05 06:52:27 UTC (rev 28002)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c	2010-04-05 07:16:22 UTC (rev 28003)
@@ -284,7 +284,11 @@
 	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





More information about the Bf-blender-cvs mailing list