git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] commit walk machinery is dangerous !

From
Nicolas Pitre <nico@cam.org>
Date
Jul 14, 2008, 23:08 UTC
Message-ID
<alpine.LFD.1.10.0807141904250.12484@xanadu.home>
In-Reply-To
<7vbq10f7wr.fsf@gitster.siamese.dyndns.org>
On Mon, 14 Jul 2008, Junio C Hamano wrote:
Show 24 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 9 in “[BUG] commit walk machinery is dangerous !”
  1. Nicolas PitreJul 14, 2008
  2. Junio C HamanoJul 14, 2008
  3. Nicolas PitreJul 14, 2008
  4. Junio C HamanoJul 14, 2008
  5. Nicolas PitreJul 14, 2008
  6. 1/2 restore legacy behavior for read_sha1_file()Nicolas Pitre, Jul 15, 2008
  7. 2/2 test case for previous commitNicolas Pitre, Jul 15, 2008
  8. Nicolas PitreJul 15, 2008
  9. unpack_entry (was: [BUG] commit walk machinery is dangerous !)Shawn O. Pearce, Jul 15, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.