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

Re: [PATCH] Fix delta integer overflows

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 8, 2017, 11:38 UTC
Message-ID
<alpine.DEB.2.21.1.1708081336410.4271@virtualbox>
In-Reply-To
<20170808062047.GA4091@mail.zuhause>
Hi Martin,
On Tue, 8 Aug 2017, Martin Koegler wrote:
Show 7 quoted lines
> On Mon, Aug 07, 2017 at 09:39:12PM +0200, Johannes Schindelin wrote:
> > If you want to work on data in memory, then size_t is the appropriate data
> > type. We already use it elsewhere. Let's use it here, too, without the
> > intermediate bump from the incorrect `int` to the equally incorrect
> > `long`.
> 
> I disagree with "We already use it elsewhere.".
By "it" I meant "size_t".
> The whole delta code uses "unsigned long" - look at delta.h. Look at
> unpack-objects.c. Or cache.h. Or pack-objects.c. Or index-pack.c.
I know that. It is a major bug in the source code.
> Other possible cases:
> git grep "unsigned long" |grep size
Yes, even more bugs.
> So the codebase still suggests, that "unsigned long" is the data type
> for storing object sizes.

And it would be wrong, and we know it already. Most importantly, Junio knows it already.

> I would be fine with resubmitting a patch using size_t/off_t for the
> touched parts - changing the whole core code is a too invasive change
> for a bug fix.

Sorry, my mistake: I never meant to burden you with the invasive change. I only wanted you to change the `int` to `size_t` right away.

Thanks, Johannes

Previous: Martin KoeglerNext: Junio C Hamano
Message 9 of 11 in “Fix delta integer overflows”
  1. Fix delta integer overflowsMartin Koegler, Aug 7, 2017
  2. Junio C HamanoAug 7, 2017
  3. Johannes SchindelinAug 7, 2017
  4. Junio C HamanoAug 7, 2017
  5. Johannes SchindelinAug 7, 2017
  6. Junio C HamanoAug 7, 2017
  7. Junio C HamanoAug 7, 2017
  8. Martin KoeglerAug 8, 2017
  9. Johannes SchindelinAug 8, 2017
  10. Junio C HamanoAug 8, 2017
  11. Martin KoeglerAug 8, 2017

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.