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

Re: [PATCH 0/2] tree-walk: use size_t for tree sizes

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Nov 17, 2026, 21:42 UTC
Message-ID
<20261117214253.716770-1-gitter.spiros@gmail.com>
In-Reply-To
<cover.1793357680.git.gitter.spiros@gmail.com>
Hi,

A gentle ping on this two-patch series, which has not had any comments so far. It still applies cleanly to current master (e1ec09b23c), and nothing has touched tree-walk.[ch] or tree.[ch] since it was sent.

To recap briefly: struct tree_desc keeps the size of the tree buffer in an "unsigned int", so on every platform a tree of 4GiB or more is seen only up to "size mod 2^32". The walk never reads past the buffer, but when the cut falls between two entries the rest of the tree silently disappears, for "git ls-tree" as well as for the checks in fsck_tree(). 2/2 does the same for struct tree, which matters only where "long" has 32 bits while size_t has 64, as on Windows.

I would appreciate an opinion on two questions:
 - Is this worth fixing at all, given that such a tree can only be
   crafted on purpose?
 - If it is, is widening the types the right approach, or should a
   tree too large for the walker rather be rejected, e.g. in
   init_tree_desc_gently(), which fsck_tree() also uses?
If there is no interest, I am happy to drop the series.

Thanks, Elia

Previous: Junio C Hamano
Message 6 of 6 in “tree-walk: use size_t for tree sizes”
  1. 0/2 tree-walk: use size_t for tree sizesElia Pinto, Oct 30, 2026
  2. 1/2 tree-walk: use size_t for the size of tree buffersElia Pinto, Oct 30, 2026
  3. Junio C HamanoNov 18, 2026
  4. 2/2 tree: use size_t for the size of parsed treesElia Pinto, Oct 30, 2026
  5. Junio C HamanoNov 18, 2026
  6. Elia PintoNov 17, 2026

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.