diff options
author | Martin Poirier <theeth@yahoo.com> | 2006-12-03 21:30:34 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2006-12-03 21:30:34 +0300 |
commit | 953cd28b677590f30f1ae42e7210639f2cd4b6bc (patch) | |
tree | 385525c498a84963a45dd47693766058017b885c /source | |
parent | 869a9e4881d29ce69f61c84c8922f8e6742b1a01 (diff) |
Klocwork pointer sanity checks in transform.
Diffstat (limited to 'source')
-rwxr-xr-x | source/blender/src/transform.c | 10 | ||||
-rwxr-xr-x | source/blender/src/transform_conversions.c | 20 |
2 files changed, 23 insertions, 7 deletions
diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 4524c7c5c88..36bbc693c2d 100755 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -1611,7 +1611,7 @@ int ToSphere(TransInfo *t, short mval[2]) float vec[3]; float ratio, radius; int i; - char str[50]; + char str[64]; TransData *td = t->data; ratio = InputHorizontalRatio(t, mval); @@ -1833,7 +1833,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) int Rotation(TransInfo *t, short mval[2]) { TransData *td = t->data; - char str[50]; + char str[64]; float final; @@ -1968,7 +1968,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a int Trackball(TransInfo *t, short mval[2]) { - char str[80]; + char str[128]; float axis1[3], axis2[3]; float mat[3][3], totmat[3][3], smat[3][3]; float phi[2]; @@ -2209,7 +2209,7 @@ int ShrinkFatten(TransInfo *t, short mval[2]) float vec[3]; float distance; int i; - char str[50]; + char str[64]; TransData *td = t->data; distance = -InputVerticalAbsolute(t, mval); @@ -2437,7 +2437,7 @@ int PushPull(TransInfo *t, short mval[2]) float vec[3], axis[3]; float distance; int i; - char str[50]; + char str[128]; TransData *td = t->data; distance = InputVerticalAbsolute(t, mval); diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 822e6f90e00..17b8e8461fa 100755 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -268,6 +268,11 @@ static void createTransTexspace(TransInfo *t) ID *id; ob= OBACT; + + if (ob==NULL) { // Should logically happen, but still... + t->total = 0; + return; + } id= ob->data; if(id==NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) { @@ -666,6 +671,10 @@ static void pose_grab_with_ik_add(bPoseChannel *pchan) bKinematicConstraint *data; bConstraint *con; + if (pchan == NULL) { // Sanity check + return; + } + /* rule: not if there's already an IK on this channel */ for(con= pchan->constraints.first; con; con= con->next) if(con->type==CONSTRAINT_TYPE_KINEMATIC) @@ -717,11 +726,13 @@ static void pose_grab_with_ik_children(bPose *pose, Bone *bone) /* main call which adds temporal IK chains */ static void pose_grab_with_ik(Object *ob) { - bArmature *arm= ob->data; + bArmature *arm; bPoseChannel *pchan, *pchansel= NULL; if(ob==NULL || ob->pose==NULL || (ob->flag & OB_POSEMODE)==0) return; + + arm = ob->data; /* rule: only one Bone */ for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { @@ -2390,7 +2401,12 @@ static void createTransObject(TransInfo *t) ipoflag= ob->ipoflag; ob->ipoflag &= ~OB_OFFS_OB; - pushdata(ob->loc, 7*3*4); // tsk! tsk! + /* + * This is really EVIL code that pushes down Object values + * (loc, dloc, orig, size, dsize, rot, drot) + * */ + + pushdata((void*)ob->loc, 7 * 3 * sizeof(float)); // tsk! tsk! for(ik= elems.first; ik; ik= ik->next) { |