Thread (2 messages) 2 messages, 2 authors, 2016-06-15

Re: [RFC/PATCH] ignore memcmp() overreading in bsearch() callback

From: Jeff King <hidden>
Date: 2016-06-15 22:55:46

On Tue, Jan 15, 2013 at 08:55:32AM -0800, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
On Mon, Jan 14, 2013 at 03:36:21PM -0800, Junio C Hamano wrote:
quoted
It appears that memcmp() uses the usual "one word at a time"
comparison and triggers valgrind in a callback of bsearch() used in
the refname search.  I can easily trigger problems in any script
with test_commit (e.g. "sh t0101-at-syntax.sh --valgrind -i -v")
without this suppression.
Out of curiosity, what platform do you see this on? I can't reproduce on
glibc.
    Debian GNU/Linux 6.0.6 (squeeze), on Linux 2.6.32-5-amd64.
    libc-bin              2.11.3-4
    valgrind-3.6.0.SVN-Debian
    gcc                   4:4.4.5-1
Interesting. I can reproduce easily on my squeeze machine, but not my
wheezy. So presumably it is a false positive fixed either in libc (I
have 2.13-38 on the "good" box) or valgrind (1:3.8.1-1).

However, the error that valgrind reports is on the call to
"strlen(ent->name)", not memcmp (but it has suffered from the same SSE
issues in the past).

So I feel pretty confident that it really is a false positive; you may
want to double-check the offending call for the commit message (though I
would not be surprised if it is triggerable from both). I think it also
means that René's suggestion to use strncmp cannot be relied on to
silence the warning (though I am not opposed to doing it anyway if we
think it is more clear).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help