Re: [PATCH] Don't dereference NULL upon lookup_tree failure.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 21, 2007, 23:40 UTC
- Message-ID
- <7vve6r39bp.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <87bq8jvd1g.fsf@rho.meyering.net>
Jim Meyering <jim@meyering.net> writes:
Show 14 quoted lines
> Junio C Hamano <gitster@pobox.com> wrote: > ... >> Sorry, I asked for a wrong thing. parse_object() reads and >> finds out the type, so type there is presumably the right type >> of the object (which is OBJ_TREE). Then parse_object_buffer() >> checks if it has already seen the object of the same SHA-1 and >> finds that somebody had earlier told that SHA-1 name is of a >> commit object. Either you found a SHA-1 collision (highly >> unlikely) or the earlier caller had lied. And I think what >> really needs to be fixed is that lying caller. That is not in >> the above call chain. > > I presume that parsecvs is the culprit, in constructing > an invalid repository...
Independent of who creates a "invalid repository", our tools should be prepared to be fed bad data and not get upset. Somebody in our code read a non-commit (or it did not read anything) and told the object layer it is a commit. That codepath needs to be tightened up, no?