Re: [PATCH 2/4] shallow.c: avoid theoretical pointer wrap-around

2016-12-02 Thread Jeff King
On Fri, Dec 02, 2016 at 09:31:02PM +0100, Rasmus Villemoes wrote: > The expression info->free+size is technically undefined behaviour in > exactly the case we want to test for. Moreover, the compiler is likely > to translate the expression to > > (unsigned long)info->free + size > (unsigned

[PATCH 2/4] shallow.c: avoid theoretical pointer wrap-around

2016-12-02 Thread Rasmus Villemoes
The expression info->free+size is technically undefined behaviour in exactly the case we want to test for. Moreover, the compiler is likely to translate the expression to (unsigned long)info->free + size > (unsigned long)info->end where there's at least a theoretical chance that the LHS could