diff options
author | Emily Shaffer <emilyshaffer@google.com> | 2020-01-07 18:31:27 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-08 09:31:18 -0800 |
commit | 573117dfa597215fbf9a3d73b7f9c71c280c684f (patch) | |
tree | 2f7c34962b20f2d7687c4abbb2ee4355039b0a7a /Documentation/git-notes.txt | |
parent | Git 2.24.1 (diff) | |
download | tgif-573117dfa597215fbf9a3d73b7f9c71c280c684f.tar.xz |
unpack-trees: watch for out-of-range index position
It's possible in a case where the index file contains a tree extension
but no blobs within that tree exist for index_pos_by_traverse_info() to
segfault. If the name_entry passed into index_pos_by_traverse_info() has
no blobs inside, AND is alphabetically later than all blobs currently in
the index file, index_pos_by_traverse_info() will segfault. For example,
an index file which looks something like this:
aaa#0
bbb/aaa#0
[Extensions]
TREE: zzz
In this example, 'index_name_pos(..., "zzz/", ...)' will return '-4',
indicating that "zzz/" could be inserted at position 3. However, when
the checks which ensure that the insertion position of "zzz/" look for a
blob at that position beginning with "zzz/", the index cache is accessed
out of range, causing a segfault.
This kind of index state is not typically generated during user
operations, and is in fact an edge case of the state being checked for
in the conditional where it was added. However, since the entry for the
BUG() line is ambiguous, tell some additional context to help Git
developers debug the failure later. When we know the name of the dir we
were trying to look up, it becomes possible to examine the index file
in a hex util to determine what went wrong; the position gives a hint
about where to start looking.
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-notes.txt')
0 files changed, 0 insertions, 0 deletions