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>
Junio C Hamano committed
Jul 11, 2022 at 16:25 UTC
e0ad13977a7f6226d753ec12aedaaa9db7e57dad
1 file changed
+1
builtin/fsck.c
+1
@@ -784,6 +784,7 @@ static int fsck_resolve_undo(struct index_state *istate)
784
error(_("%s: invalid sha1 pointer in resolve-undo"),
785
oid_to_hex(&ru->oid[i]));
786
errors_found |= ERROR_REFS;
787
+ continue;
788
}
789
obj->flags |= USED;
790
fsck_put_object_name(&fsck_walk_options, &ru->oid[i],