[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#4355) slapd crash



ando@sys-net.it wrote:
>>> >From the values you get for the temporaries in attr_merge(), print
>>> (you'll need to cast them first; replace the name with the pointer):
>>>       
>>> p ((Attribute **)a)[0][0]
>>>       
>> (gdb) up
>> #1  0xfefd09c4 in raise () from /usr/lib/libc.so.1
>> (gdb) up
>> #2  0xfefb6ce0 in abort () from /usr/lib/libc.so.1
>> (gdb) up
>> #3  0xfefb6f80 in _assert () from /usr/lib/libc.so.1
>> (gdb) up
>> #4  0x0005b48c in attr_merge (e=0xf7ffeeb0, desc=0x390800, vals=0x2967558,
>>     nvals=0x0) at attr.c:210
>> 210                     assert( ( nvals == NULL && (*a)->a_nvals == (*a)->a_vals )
>> (gdb) p ((Attribute **)a)[0][0]
>> $3 = {a_desc = 0x390800, a_vals = 0x2997668, a_nvals = 0x2997698,
>>   a_next = 0x0, a_flags = 0}
>>     
>
> OK, a_vals and a_nvals differ, while NULL is passed as nvals; this
> triggers the assertion.  
>
> I'm unsure about how this could have happened, I suspect the value was
> replicated, and thus passed thru normalization; does it make sense?
>
> I think this can be fixed in two different manners:
>
> 1) simple hack: provide normalized values as well in ppolicy
>   

This is what I patched in ppolicy.c.
> 2) more general approach: replace that assertion with some "smart" code
> that takes care of copying a_vals into a_nvals if the two pointers are
> equal and (nvals != NULL && nvals != vals) is passed and, conversely,
> appends vals to a_nvals if nvals == NULL is passed and a_nvals !=
> a_vals.
>   

This would just mask future bugs. The odd thing is that test022 already 
tests multiple Bind failures, so I would have expected it to have 
tripped this assert already. Will have to look further into that test.

-- 
  -- Howard Chu
  Chief Architect, Symas Corp.  http://www.symas.com
  Director, Highland Sun        http://highlandsun.com/hyc
  OpenLDAP Core Team            http://www.openldap.org/project/