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

Re: [PATCH V2 1/2] Fix delta integer overflows

From
Jeff King <peff@peff.net>
Date
Aug 10, 2017, 20:36 UTC
Message-ID
<20170810203612.lt342yq3gnfadjlp@sigill.intra.peff.net>
In-Reply-To
<xmqqmv772nmc.fsf@gitster.mtv.corp.google.com>
On Thu, Aug 10, 2017 at 01:07:07PM -0700, Junio C Hamano wrote:
> Perhaps we should teach the receiving end to notice that the varint
> data it reads encodes a size that is too large for it to grok and
> die.  With that, we can safely move forward with whatever size_t
> each platform uses.

Yes, this is very important even for "unsigned long". I'd worry that malicious input could cause us to wrap to 0, and we'd potentially write into a too-small buffer[1].

There's some prior art with checking this against bitsizeof() in unpack_object_header_buffer() but get_delta_hdr_size() does not seem to have a check.

-Peff
[1] In most cases it's _probably_ not a vulnerability to wrap here,
    because we'd just read less data than we ought to. But it makes me
    nervous nonetheless.
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 10 in “Fix delta integer overflows”
  1. 1/2 Fix delta integer overflowsMartin Koegler, Aug 10, 2017
  2. 2/2 Convert size datatype to size_tMartin Koegler, Aug 10, 2017
  3. Johannes SchindelinAug 10, 2017
  4. Junio C HamanoAug 10, 2017
  5. Martin KoeglerAug 11, 2017
  6. Junio C HamanoAug 10, 2017
  7. Jeff KingAug 10, 2017
  8. Junio C HamanoAug 11, 2017
  9. Martin KoeglerAug 11, 2017
  10. Junio C HamanoAug 11, 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.