git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] dir.c: skip .gitignore, etc larger than INT_MAX
Date: Fri, 31 May 2024 08:10:14 -0700	[thread overview]
Message-ID: <xmqqbk4mhvah.fsf@gitster.g> (raw)
In-Reply-To: <20240531120034.GA442032@coredump.intra.peff.net> (Jeff King's message of "Fri, 31 May 2024 08:00:34 -0400")

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.

      parent reply	other threads:[~2024-05-31 15:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 12:00 [PATCH] dir.c: skip .gitignore, etc larger than INT_MAX Jeff King
2024-05-31 15:05 ` Junio C Hamano
2024-06-04 10:39   ` Jeff King
2024-06-04 17:45     ` Junio C Hamano
2024-06-05  8:03       ` Jeff King
2024-06-05 16:23         ` Junio C Hamano
2024-05-31 15:10 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqbk4mhvah.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).