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

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Thu Jul 6 21:07:55 UTC 2017


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.

Douglas


> 
> LS
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ldb-msg.patch
Type: text/x-patch
Size: 8029 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170707/cc3cd82e/ldb-msg.bin>


More information about the samba-technical mailing list