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

Re: [PATCH] dir.c: skip .gitignore, etc larger than INT_MAX

From
Junio C Hamano <gitster@pobox.com>
Date
May 31, 2024, 15:10 UTC
Message-ID
<xmqqbk4mhvah.fsf@gitster.g>
In-Reply-To
<20240531120034.GA442032@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> We use add_patterns() to read .gitignore, .git/info/exclude, etc, as
> well as other pattern-like files like sparse-checkout. The parser for
> these uses an "int" as an index, meaning that files over 2GB will
> generally cause signed integer overflow and out-of-bounds access.

I also wondered if we need similar protection on the attribute side, but it turns out that we process the files one line at a time without holding everything in core. Both exclude and attribute subsystem are not protected against parseed _result_ consuming too much memory, but at least with your patch, we are covered on the input side.

I wonder if it is worth rewriting the exclude side to stream like attribute parsing, though. It probalby is not.

Previous: Junio C Hamano
Message 7 of 7 in “dir.c: skip .gitignore, etc larger than INT_MAX”
  1. dir.c: skip .gitignore, etc larger than INT_MAXJeff King, May 31, 2024
  2. Junio C HamanoMay 31, 2024
  3. Jeff KingJun 4, 2024
  4. Junio C HamanoJun 4, 2024
  5. Jeff KingJun 5, 2024
  6. Junio C HamanoJun 5, 2024
  7. Junio C HamanoMay 31, 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.