Repository navigation
tree-walk: reject tree entries with over-long names - #2512
Closed
HaraldNordgren wants to merge 1 commit into
Closed
HaraldNordgren wants to merge 1 commit into
HaraldNordgren wants to merge 1 commit into
Conversation
Three tests in t1600 fail on master when the expensive tests are enabled, as they are in CI. They were added in 89048b4 (t1600-index: add expensive tests for over-long tree paths, 2026-10-16) and hand checkout, restore and ls-files a tree with an entry whose name is 4294967294 bytes long. The commands are expected to refuse the path as too long for the index, and they now die with "malformed mode in tree entry". The tree walker keeps the length of an entry's name in an "int", and this name does not fit. The length comes out as -2, which makes the walker step forward only 26 bytes in a SHA-1 repository and read the next entry from the middle of the name. Before 53d5cfc (tree-walk: use size_t for the size of tree buffers, 2026-10-30) the size of the tree was truncated to those same 26 bytes. The walk ended there by accident and the tests passed. Refuse a tree entry whose name is longer than INT_MAX. The three tests keep checking that the commands refuse such a tree, now with the message from the tree walker. The limit on the name of a cache entry is still covered by the "test-tool cache-entry" tests. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Member
|
Isn't this a straight-up duplicate of the just-opened gitgitgadget#2342? |
Contributor
Author
|
@dscho Yes, closing this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
t1600.13 to t1600.15 have failed in CI on master since ep/tree-walk-size-t was merged:
https://github.com/git/git/actions/runs/46338638011/job/141584820661
I cannot build the 4 GiB tree locally. With the length fields narrowed to 16 bits, a 65534-byte name reproduces the failure.
cc: Elia Pinto gitter.spiros@gmail.com
cc: Johannes Schindelin johannes.schindelin@gmx.de