Re: [PATCH] revision.c: fix possible null pointer access

2015-12-04 Thread Jeff King
On Fri, Dec 04, 2015 at 07:39:10AM -0800, Junio C Hamano wrote: > > But you can't do that computation (in the error case under > > consideration). Null can't be added to anything (as far as the > > implications of the standards go). These are horrid gotchas because > > they go against the grain of

Re: [PATCH] revision.c: fix possible null pointer access

2015-12-04 Thread Junio C Hamano
"Philip Oakley" writes: > From: "Junio C Hamano" >> Stefan Naewe writes: >> >>> Two functions dereference a tree pointer before checking >> >> Reading them a bit carefully, a reader would notice that they >> actually do not dereference the pointer at all. It just computes >> another pointer an

Re: [PATCH] revision.c: fix possible null pointer access

2015-12-03 Thread Stefan Beller
On Thu, Dec 3, 2015 at 1:34 PM, Philip Oakley wrote: > From: "Junio C Hamano" >> >> Stefan Naewe writes: >> >>> Two functions dereference a tree pointer before checking >> >> >> Reading them a bit carefully, a reader would notice that they >> actually do not dereference the pointer at all. It j

Re: [PATCH] revision.c: fix possible null pointer access

2015-12-03 Thread Philip Oakley
From: "Junio C Hamano" Stefan Naewe writes: Two functions dereference a tree pointer before checking Reading them a bit carefully, a reader would notice that they actually do not dereference the pointer at all. It just computes another pointer and that is done by adding the offset of objec

Re: [PATCH] revision.c: fix possible null pointer access

2015-12-03 Thread Stefan Naewe
On Thu, Dec 3, 2015 at 9:06 PM, Junio C Hamano wrote: > > Stefan Naewe writes: > > > Two functions dereference a tree pointer before checking > > Reading them a bit carefully, a reader would notice that they > actually do not dereference the pointer at all. It just computes > another pointer and

Re: [PATCH] revision.c: fix possible null pointer access

2015-12-03 Thread Junio C Hamano
Stefan Naewe writes: > Two functions dereference a tree pointer before checking Reading them a bit carefully, a reader would notice that they actually do not dereference the pointer at all. It just computes another pointer and that is done by adding the offset of object member in the tree struc

[PATCH] revision.c: fix possible null pointer access

2015-12-03 Thread Stefan Naewe
Two functions dereference a tree pointer before checking if the pointer is valid. Fix that by doing the check first. Signed-off-by: Stefan Naewe --- This has been reported through the CppHints newsletter (http://cpphints.com/hints/40) but doesn't seem to have made its way to the ones who care (t