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