author | Johan Herland <johan@herland.net> | |
Thu, 3 Dec 2009 03:53:54 +0000 (04:53 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 3 Dec 2009 18:10:35 +0000 (10:10 -0800) | ||
commit | 488bdf2ebe6e99fb30ad958a710b0b3f737b4d0f | |
tree | cf66eb52b97e9ba812f4f1460ac989610403eac4 | tree | snapshot |
parent | 907a0b1e04ea31cb368e9422df93d8ebb0187914 | commit | diff |
Fix crasher on encountering SHA1-like non-note in notes tree
When loading a notes tree, the code primarily looks for SHA1-like paths
whose total length (discounting directory separators) are 40 chars
(interpreted as valid note entries) or less (interpreted as subtree
entries that may in turn contain note entries when unpacked).
However, there is an additional condition that must hold for valid
subtree entries: They must be _tree_ objects (duh).
This patch adds an appropriate test for this condition, thereby fixing
the crash that occured when passing a non-tree object to the tree-walk
API.
The patch also adds another selftest verifying correct behaviour of
non-notes in note trees.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When loading a notes tree, the code primarily looks for SHA1-like paths
whose total length (discounting directory separators) are 40 chars
(interpreted as valid note entries) or less (interpreted as subtree
entries that may in turn contain note entries when unpacked).
However, there is an additional condition that must hold for valid
subtree entries: They must be _tree_ objects (duh).
This patch adds an appropriate test for this condition, thereby fixing
the crash that occured when passing a non-tree object to the tree-walk
API.
The patch also adds another selftest verifying correct behaviour of
non-notes in note trees.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes.c | diff | blob | history | |
t/t3304-notes-mixed.sh | [new file with mode: 0755] | blob |