[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58111] trunk/blender/source/blender/ editors/mesh/editface.c: add checks in paintface_flush_flags for faces which have no original index values .

Campbell Barton ideasman42 at gmail.com
Tue Jul 9 10:25:31 CEST 2013


Revision: 58111
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58111
Author:   campbellbarton
Date:     2013-07-09 08:25:30 +0000 (Tue, 09 Jul 2013)
Log Message:
-----------
add checks in paintface_flush_flags for faces which have no original index values. (could give out of bounds writes)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editface.c

Modified: trunk/blender/source/blender/editors/mesh/editface.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editface.c	2013-07-09 08:23:01 UTC (rev 58110)
+++ trunk/blender/source/blender/editors/mesh/editface.c	2013-07-09 08:25:30 UTC (rev 58111)
@@ -95,9 +95,11 @@
 		
 		/* loop over tessfaces */
 		for (i = 0; i < totface; i++) {
-			/* Copy flags onto the original tessface from its original poly */
-			mp_orig = me->mpoly + index_array[i];
-			faces[i].flag = mp_orig->flag;
+			if (index_array[i] != ORIGINDEX_NONE) {
+				/* Copy flags onto the original tessface from its original poly */
+				mp_orig = me->mpoly + index_array[i];
+				faces[i].flag = mp_orig->flag;
+			}
 		}
 	}
 
@@ -107,9 +109,11 @@
 
 		/* loop over final derived polys */
 		for (i = 0; i < totpoly; i++) {
-			/* Copy flags onto the final derived poly from the original mesh poly */
-			mp_orig = me->mpoly + index_array[i];
-			polys[i].flag = mp_orig->flag;
+			if (index_array[i] != ORIGINDEX_NONE) {
+				/* Copy flags onto the final derived poly from the original mesh poly */
+				mp_orig = me->mpoly + index_array[i];
+				polys[i].flag = mp_orig->flag;
+			}
 		}
 	}
 
@@ -120,9 +124,11 @@
 
 		/* loop over tessfaces */
 		for (i = 0; i < totface; i++) {
-			/* Copy flags onto the final tessface from its final poly */
-			mp_orig = polys + index_array[i];
-			faces[i].flag = mp_orig->flag;
+			if (index_array[i] != ORIGINDEX_NONE) {
+				/* Copy flags onto the final tessface from its final poly */
+				mp_orig = polys + index_array[i];
+				faces[i].flag = mp_orig->flag;
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list