[PATCH] ldb: Fix index out of bound in ldb_msg_find_common_values

Lukas Slebodnik lslebodn at redhat.com
Fri Jul 7 07:21:11 UTC 2017


On (07/07/17 09:07), Douglas Bagnall wrote:
>On 07/07/17 00:18, Lukas Slebodnik wrote:
>> On (06/07/17 22:20), Douglas Bagnall via samba-technical wrote:
>>> On 06/07/17 21:48, Lukas Slebodnik wrote:
>>>>
>>>> Have you tried to run unit test with valgrind / ore some address/memory
>>>> sanitizer?
>>>
>>> No. I think I have lost that habit because I am so used to writing python
>>> tests that act as clients, where valgrind tells you nothing at all useful. 
>>>
>> 
>> I ran then and it passed.
>> For record
>>    LD_LIBRARY_PATH=bin/shared/ valgrind -v bin/ldb_msg_test
>> or running everything with valgrind
>>    valgrind -v --trace-children=yes make check
>> 
>> I was not running it from samba git but after extracting ldb from tarball
>> + patching source code.
>> 
>> 
>>>> Otherwise looks good to me. But it would be good to fix also comment from
>>>> different mail in this thread about remove_dupes.
>>>>
>>>> Thank you very much for unit tests. They helped us to find bug :-)
>>>> I really appreciate it.
>>>
>>> You are welcome.
>>>
>> 
>> BTW I checked unit test one more time and you ere right.
>> It was caused by "el3->num_values == 0" because el3 was changed
>> after 1st initialisation.
>> 
>> So my patch is not needed; your solution is more elegant
>> and my patch can be dropped from patch set.
>
>I think your first patch is still correct. It makes that loop more
>succinct and safe at no cost.
>
>I have added a few more asserts about element size in the tests.
>

Thank you.

ACK

LS



More information about the samba-technical mailing list