Re: plea for review



On Wed, 24 Jan 2001, Tim Janik wrote:

> On Wed, 24 Jan 2001, Alexander Larsson wrote:
> > check_derivation_U:
> >   pnode = lookup_type_node_L (parent_type);
> >   finfo = type_node_fundamental_info_L (pnode);
> >   if (!pnode)
> >     ...
> > might call type_node_fundamental_info_L (NULL), which looks bad.
> 
> it acquires a lock before that, in short:
> static gboolean
> check_derivation_U (GType        parent_type,
>                     const gchar *type_name)
> {
>   G_READ_LOCK (&type_rw_lock);
>   pnode = lookup_type_node_L (parent_type);
>   finfo = type_node_fundamental_info_L (pnode);
>   [...]
>   G_READ_UNLOCK (&type_rw_lock);
>   return TRUE;
> }
> 
> so it calls _L function while a lock is being held.
 
Yes, the locking is correct, but the check if pnode == NULL is done after
the type_node_fundamental_info_L (pnode) call, which can dereference
pnode leading to crash and burn.

/ Alex






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]