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

Re: [PATCH] builtin-fast-export.c: add default case to avoid crash on corrupt repo

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 21, 2009, 23:54 UTC
Message-ID
<7vd4cabffl.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1237675051-6688-1-git-send-email-kusmabite@gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
> This small issue was discovered by Benjamin Kramers Clang-runs on the
> git code-base. If a tag object points to an object that is not a commit
> or a blob, an invalid pointer is dereferenced in the code that followed.

A tag can point at anything, so this is not an issue about "crash on a _corrupt_ repository".

I am not very familiar with this program, but the codepath involved should be prepared to _see_ any type of object instead of dying.

What to do after _seeing_ a type of object is a different matter. It appears that there is no way to feed a tree object to fast-import, but I think the fast-import language can represent a tag that points at another tag just fine. So the best you can do is perhaps to issue a warning "skipping a tag that points at a tree object" and impoement a proper handling of a tag that points at a tag.

Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 2 of 6 in “builtin-fast-export.c: add default case to avoid crash on corrupt repo”
  1. builtin-fast-export.c: add default case to avoid crash on corrupt repoErik Faye-Lund, Mar 21, 2009
  2. Junio C HamanoMar 21, 2009
  3. Erik Faye-LundMar 22, 2009
  4. Erik Faye-LundMar 22, 2009
  5. Junio C HamanoMar 22, 2009
  6. Shawn O. PearceMar 23, 2009

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.