The first if tests for:

(afunc->default_value || afunc->system_default) &&

  So default_value can be NULL if system_default is not. Or they are equal
and NOT NULL.

  The second if tests for:

if ((!iupStrEqualNoCase(afunc->default_value, afunc->system_default)) ||

  If they are not equal OR

  then they are equal and not NULL at:

          (afunc->call_global_default &&
iupGlobalDefaultColorChanged(afunc->default_value)))

  There is no need for " && afunc->default_value"

Best,
Scuri


2018-01-19 0:06 GMT-02:00 Ranier VF <ranier_...@hotmail.com>:

> Hi,
> Issue found by Coverity Scan.
> CID 210573 (#1 of 1): Dereference after null check (FORWARD_NULL)
> var_deref_model: Passing null pointer afunc->default_value to
> iupGlobalDefaultColorChanged, which dereferences it.
>
> --- a\src\iup_classattrib.c     Fri Oct 14 13:48:50 2016
> +++ b\src\iup_classattrib.c     Fri Jan 19 00:01:03 2018
> @@ -990,7 +990,8 @@
>          !(afunc->flags & IUPAF_HAS_ID))
>      {
>        if ((!iupStrEqualNoCase(afunc->default_value,
> afunc->system_default)) ||
> -          (afunc->call_global_default && iupGlobalDefaultColorChanged(
> afunc->default_value)))
> +          (afunc->call_global_default && afunc->default_value &&
> +           iupGlobalDefaultColorChanged(afunc->default_value)))
>        {
>          if ((!ih->handle && (afunc->flags & IUPAF_NOT_MAPPED)) ||
>              (ih->handle && !(afunc->flags & IUPAF_NOT_MAPPED)))
>
> Best.
> Ranier
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to