git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] commit walk machinery is dangerous !
Date: Mon, 14 Jul 2008 19:08:59 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0807141904250.12484@xanadu.home> (raw)
In-Reply-To: <7vbq10f7wr.fsf@gitster.siamese.dyndns.org>

On Mon, 14 Jul 2008, Junio C Hamano wrote:

> Nicolas Pitre <nico@cam.org> writes:
> 
> > However this time a corruption turned up and exposed what I think is a 
> > major flaw in git's error checking.  To demonstrate it, I created the 
> > following test case.  Turning the error() into a die() on line 772 of 
> > commit.c makes this test pass but I don't know if this is the 
> > appropriate fix (e.g. some attempt to parse non existing commits could 
> > be valid usage, etc.).  Note this is critical only for git versions 
> > later than commit 8eca0b47ff15.
> 
> Which probably means we should revert that commit as faulty?  IIRC, before
> that commit we did check and error out correctly but you loosened the
> check to introduce "a major flaw" with that commit.
> 
> $ for b in maint master next pu
>   do
>       echo -n $b; git cat-file blob $b:commit.c | wc -l
>   done
> maint 672
> master 672
> next 779
> pu 789
> 
> Hmph...

Well, most of them aren't that critical.  If anything they will only 
cause a segfault if ever the return value is not checked.

It is those with semantic meaning (e.g. object doesn't exist) which 
should be audited, especially if used in the context of repository 
modification, which pretty much limits it to the test case I produced.


Nicolas

  reply	other threads:[~2008-07-14 23:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 20:54 [BUG] commit walk machinery is dangerous ! Nicolas Pitre
2008-07-14 21:55 ` Junio C Hamano
2008-07-14 23:08   ` Nicolas Pitre [this message]
2008-07-14 23:32     ` Junio C Hamano
2008-07-14 23:39       ` Nicolas Pitre
2008-07-15  1:46         ` [PATCH 1/2] restore legacy behavior for read_sha1_file() Nicolas Pitre
2008-07-15  1:50           ` [PATCH 2/2] test case for previous commit Nicolas Pitre
2008-07-15  5:12           ` [PATCH 1/2] restore legacy behavior for read_sha1_file() Nicolas Pitre
2008-07-15  5:10       ` unpack_entry (was: [BUG] commit walk machinery is dangerous !) Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.1.10.0807141904250.12484@xanadu.home \
    --to=nico@cam.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).