Git development
 help / color / mirror / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>, git@vger.kernel.org
Cc: benpeart@microsoft.com
Subject: Re: [PATCH] fsmonitor: avoid signed integer overflow / infinite loop
Date: Sun, 16 Jun 2019 21:17:24 -0400	[thread overview]
Message-ID: <0915f2bc-5818-3bf5-34c2-7c783363cc34@gmail.com> (raw)
In-Reply-To: <20190615161135.57269-1-carenas@gmail.com>

On 6/15/2019 12:11 PM, Carlo Marcelo Arenas Belón wrote:
> 883e248b8a ("fsmonitor: teach git to optionally utilize a file system
> monitor to speed up detecting new or changed files.", 2017-09-22) uses
> an int in a loop that would wrap if index_state->cache_nr (unsigned)
> is bigger than INT_MAX

Thanks for catching this. I wonder if there is a compiler setting or
static analysis that caught this so we can avoid the issue in the future.

Also, INT_MAX is ~2.1 billion, and the largest indexes I know about have
around 4 million entries, so it is unlikely that you hit this as a runtime
error. Still worth fixing!

Thanks,
-Stolee

  reply	other threads:[~2019-06-17  1:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15 16:11 [PATCH] fsmonitor: avoid signed integer overflow / infinite loop Carlo Marcelo Arenas Belón
2019-06-17  1:17 ` Derrick Stolee [this message]
2019-06-17  7:25   ` Carlo Arenas

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=0915f2bc-5818-3bf5-34c2-7c783363cc34@gmail.com \
    --to=stolee@gmail.com \
    --cc=benpeart@microsoft.com \
    --cc=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    /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