[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47736] trunk/blender/source/blender/ blenkernel/intern/armature.c: Fix invalid array index in armature_deform_verts().

Sergey Sharybin sergey.vfx at gmail.com
Mon Jun 11 13:04:47 CEST 2012


Hey Nick!

I've been thinking about such a fix, but that's not actually full fix.
There're still lot's of places in blender who assumes
def_nr is not negative. And the real fix would actually be to figure out
why this index became negative due to it
shouldn't actually.

Checked the code, but can't find place where it could happen.

On Mon, Jun 11, 2012 at 5:01 PM, Nicholas Bishop
<nicholasbishop at gmail.com>wrote:

> Revision: 47736
>
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47736
> Author:   nicholasbishop
> Date:     2012-06-11 11:00:58 +0000 (Mon, 11 Jun 2012)
> Log Message:
> -----------
> Fix invalid array index in armature_deform_verts().
>
> Check that the def_nr is non-negative before using as index.
>
> Fixes bug [#31700] Crash when opening .blend file on 64bit environment
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/blenkernel/intern/armature.c
>
> Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/armature.c   2012-06-11
> 10:31:24 UTC (rev 47735)
> +++ trunk/blender/source/blender/blenkernel/intern/armature.c   2012-06-11
> 11:00:58 UTC (rev 47736)
> @@ -986,7 +986,7 @@
>
>                        for (j = dvert->totweight; j != 0; j--, dw++) {
>                                const int index = dw->def_nr;
> -                               if (index < defbase_tot && (pchan =
> defnrToPC[index])) {
> +                               if (index >= 0 && index < defbase_tot &&
> (pchan = defnrToPC[index])) {
>                                        float weight = dw->weight;
>                                        Bone *bone = pchan->bone;
>                                        pdef_info = pdef_info_array +
> defnrToPCIndex[index];
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>



-- 
With best regards, Sergey Sharybin


More information about the Bf-committers mailing list