{"thread":{"id":"28819","subject":"[PATCH] name-hash.c: always initialize dir_next pointer","startedAt":"2011-11-01T22:21:06Z","lastAt":"2011-11-01T22:39:49Z","messageCount":3,"participants":["Johannes Sixt","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"178655","messageId":"4EB070D2.4040709@kdbg.org","threadId":"28819","inReplyTo":null,"subject":"[PATCH] name-hash.c: always initialize dir_next pointer","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2011-11-01T22:21:06Z","receivedAt":"2011-11-01T22:21:06Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Test t2021-checkout-overwrite.sh reveals a segfault in 'git add' on a\ncase-insensitive file system when git is compiled with XMALLOC_POISON\ndefined. The reason is that 2548183b (fix phantom untracked files when\ncore.ignorecase is set) added a new member dir_next to struct cache_entry,\nbut forgot to initialize it in all cases.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n You can also insert git config core.ignorecase true before the first\n test script in t2021 to see the segfault.\n\n I actually found the crash with an MSVC debug build, which has something\n like XMALLOC_POISON built-in.\n\n name-hash.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/name-hash.c b/name-hash.c\nindex 225dd76..d8d25c2 100644\n--- a/name-hash.c\n+++ b/name-hash.c\n@@ -74,7 +74,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)\n \tif (ce->ce_flags & CE_HASHED)\n \t\treturn;\n \tce->ce_flags |= CE_HASHED;\n-\tce->next = NULL;\n+\tce->next = ce->dir_next = NULL;\n \thash = hash_name(ce->name, ce_namelen(ce));\n \tpos = insert_hash(hash, ce, &istate->name_hash);\n \tif (pos) {\n-- \n1.7.7.1.586.ga0958b\n"},{"id":"178656","messageId":"7vbosvlbjt.fsf@alter.siamese.dyndns.org","threadId":"28819","inReplyTo":"4EB070D2.4040709@kdbg.org","subject":"Re: [PATCH] name-hash.c: always initialize dir_next pointer","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-01T22:31:34Z","receivedAt":"2011-11-01T22:31:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"},{"id":"178659","messageId":"20111101223949.GA15578@sigill.intra.peff.net","threadId":"28819","inReplyTo":"4EB070D2.4040709@kdbg.org","subject":"Re: [PATCH] name-hash.c: always initialize dir_next pointer","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-11-01T22:39:49Z","receivedAt":"2011-11-01T22:39:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Nov 01, 2011 at 11:21:06PM +0100, Johannes Sixt wrote:\n\n> Test t2021-checkout-overwrite.sh reveals a segfault in 'git add' on a\n> case-insensitive file system when git is compiled with XMALLOC_POISON\n> defined. The reason is that 2548183b (fix phantom untracked files when\n> core.ignorecase is set) added a new member dir_next to struct cache_entry,\n> but forgot to initialize it in all cases.\n> \n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  You can also insert git config core.ignorecase true before the first\n>  test script in t2021 to see the segfault.\n\nYikes, thanks.\n\n-Peff\n"}]}