[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40379] trunk/blender/source/blender/ editors/space_view3d/drawmesh.c: fix possible crasg in recent texface commit - material pointer could be used un-inirialized .

Dalai Felinto dfelinto at gmail.com
Tue Sep 20 07:20:48 CEST 2011


Hi Campbell,
Shouldn't be enough to initialize ma as NULL here?:

-Material *ma;
+Material *ma=NULL;

(thanks for the post-commit reviews btw)
--
Dalai

2011/9/19 Campbell Barton <ideasman42 at gmail.com>

> Revision: 40379
>
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40379
> Author:   campbellbarton
> Date:     2011-09-20 04:45:01 +0000 (Tue, 20 Sep 2011)
> Log Message:
> -----------
> fix possible crasg in recent texface commit - material pointer could be
> used un-inirialized.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/editors/space_view3d/drawmesh.c
>
> Modified: trunk/blender/source/blender/editors/space_view3d/drawmesh.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_view3d/drawmesh.c
>  2011-09-20 04:38:59 UTC (rev 40378)
> +++ trunk/blender/source/blender/editors/space_view3d/drawmesh.c
>  2011-09-20 04:45:01 UTC (rev 40379)
> @@ -518,15 +518,14 @@
>  static int wpaint__setSolidDrawOptions(void *userData, int index, int
> *drawSmooth_r)
>  {
>        Mesh *me = (Mesh*)userData;
> -       Material *ma;
>
>        if (me->mface) {
> -               int matnr = me->mface[index].mat_nr;
> -               ma = me->mat[matnr];
> -       }
> +               short matnr= me->mface[index].mat_nr;
> +               Material *ma= me->mat[matnr];
>
> -       if ( ma && (ma->game.flag & GEMAT_INVISIBLE)) {
> -               return 0;
> +               if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
> +                       return 0;
> +               }
>        }
>
>        *drawSmooth_r = 1;
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>


More information about the Bf-committers mailing list