diff options
author | Linus Torvalds <torvalds@osdl.org> | 2006-09-04 08:34:12 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-09-04 15:24:10 -0700 |
commit | 5d44cd1c8b27fb677fedc886303d38b19fbb07f7 (patch) | |
tree | c77ca9272226511f3730f168400aae621ddf7c71 /gitweb | |
parent | gitweb: Change the name of diff to parent link in "commit" view to "diff (diff) | |
download | tgif-5d44cd1c8b27fb677fedc886303d38b19fbb07f7.tar.xz |
Fix git-fsck-objects SIGSEGV/divide-by-zero
If you try to fsck a repository that isn't entirely empty, but that has no
inter-object references (ie all the objects are blobs, and don't refer to
anything else), git-fsck-objects currently fails.
This probably cannot happen in practice, but can be tested with something
like
git init-db
touch dummy
git add dummy
git fsck-objects
where the fsck will die by a divide-by-zero when it tries to look up the
references from the one object it found (hash_obj() will do a modulus by
refs_hash_size).
On some other archiectures (ppc, sparc) the divide-by-zero will go
unnoticed, and we'll instead SIGSEGV when we hit the "refs_hash[j]"
access.
So move the test that should protect against this from mark_reachable()
into lookup_object_refs(), which incidentally in the process also fixes
mark_reachable() itself (it used to not mark the one object that _was_
reachable, because it decided that it had no refs too early).
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'gitweb')
0 files changed, 0 insertions, 0 deletions