[Bf-blender-cvs] [9036fa6] master: Fix buffer overrun lofting nurbs

Campbell Barton noreply at git.blender.org
Mon Aug 3 15:24:05 CEST 2015


Commit: 9036fa6b2e47c1cd6f208e9a128771752766c5e8
Author: Campbell Barton
Date:   Mon Aug 3 23:18:09 2015 +1000
Branches: master
https://developer.blender.org/rB9036fa6b2e47c1cd6f208e9a128771752766c5e8

Fix buffer overrun lofting nurbs

===================================================================

M	source/blender/editors/curve/editcurve.c

===================================================================

diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 3163b54..d410111 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -3591,15 +3591,17 @@ static void switchdirection_knots(float *base, int tot)
 		fp1++; 
 		fp2--;
 	}
+
 	/* and make in increasing order again */
-	a = tot;
+	a = tot - 1;
 	fp1 = base;
-	fp2 = tempf = MEM_mallocN(sizeof(float) * a, "switchdirect");
+	fp2 = tempf = MEM_mallocN(sizeof(float) * tot, "switchdirect");
 	while (a--) {
 		fp2[0] = fabsf(fp1[1] - fp1[0]);
 		fp1++;
 		fp2++;
 	}
+	fp2[0] = 0.0f;
 
 	a = tot - 1;
 	fp1 = base;




More information about the Bf-blender-cvs mailing list