* [PATCH] name-hash.c: always initialize dir_next pointer
@ 2011-11-01 22:21 Johannes Sixt
2011-11-01 22:31 ` Junio C Hamano
2011-11-01 22:39 ` Jeff King
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Sixt @ 2011-11-01 22:21 UTC (permalink / raw
To: Jeff King; +Cc: git, Junio C Hamano
Test t2021-checkout-overwrite.sh reveals a segfault in 'git add' on a
case-insensitive file system when git is compiled with XMALLOC_POISON
defined. The reason is that 2548183b (fix phantom untracked files when
core.ignorecase is set) added a new member dir_next to struct cache_entry,
but forgot to initialize it in all cases.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
You can also insert git config core.ignorecase true before the first
test script in t2021 to see the segfault.
I actually found the crash with an MSVC debug build, which has something
like XMALLOC_POISON built-in.
name-hash.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/name-hash.c b/name-hash.c
index 225dd76..d8d25c2 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -74,7 +74,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
if (ce->ce_flags & CE_HASHED)
return;
ce->ce_flags |= CE_HASHED;
- ce->next = NULL;
+ ce->next = ce->dir_next = NULL;
hash = hash_name(ce->name, ce_namelen(ce));
pos = insert_hash(hash, ce, &istate->name_hash);
if (pos) {
--
1.7.7.1.586.ga0958b
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] name-hash.c: always initialize dir_next pointer
2011-11-01 22:21 [PATCH] name-hash.c: always initialize dir_next pointer Johannes Sixt
@ 2011-11-01 22:31 ` Junio C Hamano
2011-11-01 22:39 ` Jeff King
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2011-11-01 22:31 UTC (permalink / raw
To: Johannes Sixt; +Cc: Jeff King, git
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] name-hash.c: always initialize dir_next pointer
2011-11-01 22:21 [PATCH] name-hash.c: always initialize dir_next pointer Johannes Sixt
2011-11-01 22:31 ` Junio C Hamano
@ 2011-11-01 22:39 ` Jeff King
1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2011-11-01 22:39 UTC (permalink / raw
To: Johannes Sixt; +Cc: git, Junio C Hamano
On Tue, Nov 01, 2011 at 11:21:06PM +0100, Johannes Sixt wrote:
> Test t2021-checkout-overwrite.sh reveals a segfault in 'git add' on a
> case-insensitive file system when git is compiled with XMALLOC_POISON
> defined. The reason is that 2548183b (fix phantom untracked files when
> core.ignorecase is set) added a new member dir_next to struct cache_entry,
> but forgot to initialize it in all cases.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
> You can also insert git config core.ignorecase true before the first
> test script in t2021 to see the segfault.
Yikes, thanks.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-01 22:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 22:21 [PATCH] name-hash.c: always initialize dir_next pointer Johannes Sixt
2011-11-01 22:31 ` Junio C Hamano
2011-11-01 22:39 ` Jeff King
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).