[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14889] trunk/blender/source/blender: memory corruption error fix when changing orderU/Vs with curves, this could crash blender or make odd display lists.

Campbell Barton ideasman42 at gmail.com
Sun May 18 20:44:02 CEST 2008


Revision: 14889
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14889
Author:   campbellbarton
Date:     2008-05-18 20:44:02 +0200 (Sun, 18 May 2008)

Log Message:
-----------
memory corruption error fix when changing orderU/Vs with curves, this could crash blender or make odd display lists.
the problem was that the buttons would use the first nurb if there was no 'lastnu', but the makeknots function only checked for lastnu. this meant the knots would not get re-allocated on 
values would be written outside the array.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/curve.c
    trunk/blender/source/blender/src/buttons_editing.c

Modified: trunk/blender/source/blender/blenkernel/intern/curve.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/curve.c	2008-05-18 18:05:55 UTC (rev 14888)
+++ trunk/blender/source/blender/blenkernel/intern/curve.c	2008-05-18 18:44:02 UTC (rev 14889)
@@ -583,7 +583,7 @@
 
 	/* this is for float inaccuracy */
 	if(t < knots[0]) t= knots[0];
-	else if(t > knots[opp2]) t= knots[opp2]; /* Valgrind reports an error here, use a nurbs torus and change u/v res to reproduce a crash TODO*/
+	else if(t > knots[opp2]) t= knots[opp2];
 
 	/* this part is order '1' */
         o2 = order + 1;

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2008-05-18 18:05:55 UTC (rev 14888)
+++ trunk/blender/source/blender/src/buttons_editing.c	2008-05-18 18:44:02 UTC (rev 14889)
@@ -3310,7 +3310,7 @@
 
 	if(ob==G.obedit) {
 		nu= lastnu;
-		if(nu==NULL) nu= editNurb.first;
+		if(nu==NULL) nu= lastnu= editNurb.first;
 		if(nu) {
 			if (ob->type==OB_CURVE) {
 				uiDefBut(block, LABEL, 0, "Tilt",





More information about the Bf-blender-cvs mailing list