]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck: do not dereference NULL while checking resolve-undo data
authorJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2022 23:25:14 +0000 (16:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2022 23:26:33 +0000 (16:26 -0700)
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>
builtin/fsck.c

index 4b17ccc3f4414ad66d315fe6308b67d7bdfb3427..6c73092f10dedd64a53090847c16b65232bc0c86 100644 (file)
@@ -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],