summaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-11 23:25:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-11 23:26:33 (GMT)
commite0ad13977a7f6226d753ec12aedaaa9db7e57dad (patch)
tree2d12540c2dda893d1236d6e2c02ee4cd0c9fb86b /builtin/fsck.c
parent5a5ea141e7d5317cd049cb1e93b9127c1cec04bb (diff)
downloadgit-e0ad13977a7f6226d753ec12aedaaa9db7e57dad.zip
git-e0ad13977a7f6226d753ec12aedaaa9db7e57dad.tar.gz
git-e0ad13977a7f6226d753ec12aedaaa9db7e57dad.tar.bz2
fsck: do not dereference NULL while checking resolve-undo data
When we found an invalid object recorded in the resolve-undo data, we would have ended up dereferencing NULL while fsck. Reporting the problem and going on to the next object is the right thing to do here. Noticed by SZEDER Gábor. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 4b17ccc..6c73092 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -784,6 +784,7 @@ static int fsck_resolve_undo(struct index_state *istate)
error(_("%s: invalid sha1 pointer in resolve-undo"),
oid_to_hex(&ru->oid[i]));
errors_found |= ERROR_REFS;
+ continue;
}
obj->flags |= USED;
fsck_put_object_name(&fsck_walk_options, &ru->oid[i],