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

Re: [PATCH] Fix potential segfault on cloning invalid tag

From
Jeff King <peff@peff.net>
Date
Oct 30, 2020, 15:09 UTC
Message-ID
<20201030150942.GB3282152@coredump.intra.peff.net>
In-Reply-To
<pull.906.git.git.1604058401991.gitgitgadget@gmail.com>
On Fri, Oct 30, 2020 at 11:46:41AM +0000, Sohom Datta via GitGitGadget wrote:
Show 10 quoted lines
> From: Sohom Datta <sohom.datta@learner.manipal.edu>
> 
> Git allows users to create tags pointing to object hashes
> that may or may not be commits. When a tag that doesn't
> point to a commit is used with the -b (--branch) parameter
> of git clone, git segfaults as it assumes that the tag will
> always reference a commit.
> 
> Add a check to make sure that lookup_commit_reference returns a commit
> before detaching HEAD.
This seemed eerily familiar, so I dug up these threads:
  - https://lore.kernel.org/git/20191029092735.GA84120@carpenter.lan/
  - https://lore.kernel.org/git/20191101002432.GA49846@carpenter.lan/
The interesting things are:
  - there are some other cases where we might see a non-commit, which
    are also worth covering
  - it would be friendlier to the user to put in a fallback value for
    HEAD. We already transferred the whole history, so deleting it is a
    bit less friendly than leaving it in a state the user can recover
    from locally

I think the patches there were moving in a good direction, but it looks like they just got stalled.

-Peff
Previous: Sohom Datta via GitGitGadgetNext: Sohom Datta via GitGitGadget
Message 2 of 4 in “Fix potential segfault on cloning invalid tag”
  1. Fix potential segfault on cloning invalid tagSohom Datta via GitGitGadget, Oct 30, 2020
  2. Jeff KingOct 30, 2020
  3. Avoid segfault and provide fallback when cloning invalid branch/tagSohom Datta via GitGitGadget, Nov 4, 2020
  4. Junio C HamanoNov 4, 2020

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.