From c526b1b2df09211bead73a7297992a002dc787e4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 18 May 2008 18:44:02 +0000 Subject: 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. --- source/blender/blenkernel/intern/curve.c | 2 +- source/blender/src/buttons_editing.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index ca237ecab78..d02a7c0ab9e 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -583,7 +583,7 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas /* 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; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 24209eb7f62..592a8c1b7aa 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -3310,7 +3310,7 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu) 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", -- cgit v1.2.3