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

Re: [PATCH] fsmonitor: avoid signed integer overflow / infinite loop

From
Derrick Stolee <stolee@gmail.com>
Date
Jun 17, 2019, 01:17 UTC
Message-ID
<0915f2bc-5818-3bf5-34c2-7c783363cc34@gmail.com>
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

Previous: Carlo Marcelo Arenas BelónNext: Carlo Arenas
Message 2 of 3 in “fsmonitor: avoid signed integer overflow / infinite loop”
  1. fsmonitor: avoid signed integer overflow / infinite loopCarlo Marcelo Arenas Belón, Jun 15, 2019
  2. Derrick StoleeJun 17, 2019
  3. Carlo ArenasJun 17, 2019

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.