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

Re: [PATCH] index-pack: fix truncation of off_t in comparison

From
Duy Nguyen <pclouds@gmail.com>
Date
Jun 4, 2015, 13:10 UTC
Message-ID
<CACsJy8BUEcduXf3LCbwGnJRYNb4s1KEKj_hwdo0qCtJoS4SgFw@mail.gmail.com>
In-Reply-To
<20150604123541.GA8888@peff.net>
On Thu, Jun 4, 2015 at 7:35 PM, Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> Commit c6458e6 (index-pack: kill union delta_base to save
> memory, 2015-04-18) refactored the comparison functions used
> in sorting and binary searching our delta list. The
> resulting code does something like:
>
>   int cmp_offsets(off_t a, off_t b)
>   {
>           return a - b;
>   }
>
> This works most of the time, but produces nonsensical
> results when the difference between the two offsets is
> larger than what can be stored in an "int".

Ugh.. thanks for fixing this. Too bad neither gcc, clang or coverity spotted this.

-- 
Duy
Previous: Jeff KingNext: Junio C Hamano
Message 2 of 3 in “index-pack: fix truncation of off_t in comparison”
  1. index-pack: fix truncation of off_t in comparisonJeff King, Jun 4, 2015
  2. Duy NguyenJun 4, 2015
  3. Junio C HamanoJun 4, 2015

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.