[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] fix for programmer error in file equality check due to pointer logic

From: Eric Lubin <eric_at_lubin.us>
Date: Fri, 6 Dec 2013 05:47:41 -0500

Yes. I used a static checker developed at MIT called STACK that looks for unstable code due to undefined behavior.

http://css.csail.mit.edu/stack/

Compilers pay close attention to the C standard, and are free to optimize out certain logical operations, where possible, in the case of undefined behavior. STACK attempts to find these places. In the context of this patch, the null pointer check !p with an earlier dereference is dead assuming no null pointer dereference. Since these boolean pointers are dereferenced at the beginning of the function, STACK picked up the non-NULL checks as unstable code that could be optimized out by the compiler.

On Dec 6, 2013, at 5:42 AM, Philip Martin <philip.martin_at_wandisco.com> wrote:

> Eric Lubin <eric_at_lubin.us> writes:
>
>> [[[
>> * subversion/libsvn_subr/io.c
>> (contents_three_identical_p): Fixed incorrect pointer check against NULL, when the purpose was actually to check the value stored at that pointer for true or false
>> ]]]
>
> Committed, thanks! I guess you found these via a compiler warning or
> some static checking tool?
>
> --
> Philip Martin | Subversion Committer
> WANdisco // *Non-Stop Data*
Received on 2013-12-06 11:48:23 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.