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

[PATCH 0/3] double-free with git fetch --prefetch

From
Jeff King <peff@peff.net>
Date
Nov 12, 2024, 08:32 UTC
Message-ID
<20241112083204.GA2636868@coredump.intra.peff.net>
In-Reply-To
<20241112064951.GA619985@coredump.intra.peff.net>
On Tue, Nov 12, 2024 at 01:49:51AM -0500, Jeff King wrote:
Show 7 quoted lines
> Bisecting on:
> 
>   make SANITIZE=address &&
>   bin-wrappers/git fetch --prefetch origin master
> 
> turns up my ea4780307c (fetch: free "raw" string when shrinking refspec,
> 2024-09-24). I'll see if I can figure out what's going on.

OK, it turns out to be a fairly simple bug. The hardest part was figuring out why it was not triggering all the time already in the test suite. ;)

Patch 1 is the minimal fix. It is sort-of a regression in v2.47, in that it became easier to trigger the bug; but it existed before then. Either way, it seems like material for the "maint" branch.

The other two patches are cleanups that I contemplated when doing ea4780307c. Now that this code has caused _two_ bugs which would have been impossible with the cleanups, I figured it was worth taking a stab at it.

Thanks for a clear report.
  [1/3]: fetch: adjust refspec->raw_nr when filtering prefetch refspecs
  [2/3]: refspec: drop separate raw_nr count
  [3/3]: refspec: store raw refspecs inside refspec_item
 builtin/fetch.c                   |  8 ++------
 builtin/remote.c                  | 16 ++++++++--------
 refspec.c                         | 26 ++++++++++----------------
 refspec.h                         |  6 ++----
 submodule.c                       |  8 ++++----
 t/t5582-fetch-negative-refspec.sh |  4 ++++
 6 files changed, 30 insertions(+), 38 deletions(-)
-Peff
Previous: Jeff KingNext: Jeff King
Message 3 of 7 in “[BUG REPORT] git fetch --prefetch with incorrect options hangs with 2.47.0”
  1. Eric MillsNov 11, 2024
  2. Jeff KingNov 12, 2024
  3. 0/3 double-free with git fetch --prefetchJeff King, Nov 12, 2024
  4. 1/3 fetch: adjust refspec->raw_nr when filtering prefetch refspecsJeff King, Nov 12, 2024
  5. 2/3 refspec: drop separate raw_nr countJeff King, Nov 12, 2024
  6. 3/3 refspec: store raw refspecs inside refspec_itemJeff King, Nov 12, 2024
  7. Junio C HamanoNov 12, 2024

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.