[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51027] trunk/blender/source/blender/imbuf /intern/colormanagement.c: colormanage_colorspace_get_named() can (and does ) return NULL, added checks to prevent null pointer dereferen

Sergey Sharybin sergey.vfx at gmail.com
Thu Oct 4 08:21:59 CEST 2012


Function you mentioned should not return null and if if does -- some
datablock's color space is configured wrong and that's what should be fixed.

This probably prevents crash but currently i don't consider it's a correct
fix and would want to have feedback about circumstances when crash happens
here.

On Thu, Oct 4, 2012 at 4:04 AM, Thomas Dinges <blender at dingto.org> wrote:

> Reminder, we are still in SVN freeze! (Bcon5)
>
> No need to revert this, but please no more commits until further notice.
> Thanks.
>
> Am 03.10.2012 23:52, schrieb Dan Eicher:
> > Revision: 51027
> >
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51027
> > Author:   dna
> > Date:     2012-10-03 21:52:36 +0000 (Wed, 03 Oct 2012)
> > Log Message:
> > -----------
> > colormanage_colorspace_get_named() can (and does) return NULL, added
> checks to prevent null pointer dereference if the named color profile isn't
> found
> >
> > Modified Paths:
> > --------------
> >      trunk/blender/source/blender/imbuf/intern/colormanagement.c
> >
> > Modified: trunk/blender/source/blender/imbuf/intern/colormanagement.c
> > ===================================================================
> > --- trunk/blender/source/blender/imbuf/intern/colormanagement.c
> 2012-10-03 14:17:23 UTC (rev 51026)
> > +++ trunk/blender/source/blender/imbuf/intern/colormanagement.c
> 2012-10-03 21:52:36 UTC (rev 51027)
> > @@ -881,7 +881,7 @@
> >   {
> >       ColorSpace *colorspace =
> colormanage_colorspace_get_named(from_colorspace);
> >
> > -     if (colorspace->is_data) {
> > +     if (colorspace && colorspace->is_data) {
> >               ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
> >               return;
> >       }
> > @@ -1074,7 +1074,7 @@
> >   {
> >       ColorSpace *colorspace = colormanage_colorspace_get_named(name);
> >
> > -     if (colorspace->is_data)
> > +     if (colorspace && colorspace->is_data)
> >               ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
> >       else
> >               ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
> > @@ -1086,7 +1086,7 @@
> >
> >       ibuf->float_colorspace = colorspace;
> >
> > -     if (colorspace->is_data)
> > +     if (colorspace && colorspace->is_data)
> >               ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
> >       else
> >               ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
> > @@ -1098,7 +1098,7 @@
> >
> >       ibuf->rect_colorspace = colorspace;
> >
> > -     if (colorspace->is_data)
> > +     if (colorspace && colorspace->is_data)
> >               ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
> >       else
> >               ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
> >
> > _______________________________________________
> > Bf-blender-cvs mailing list
> > Bf-blender-cvs at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
>
> --
> Thomas Dinges
> Blender Developer, Artist and Musician
>
> www.dingto.org
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
With best regards, Sergey Sharybin


More information about the Bf-committers mailing list