Skip to content

Commit

Permalink
fsck: do not dereference NULL while checking resolve-undo data
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gitster committed Jul 11, 2022
1 parent 5a5ea14 commit e0ad139
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions builtin/fsck.c
Expand Up @@ -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],
Expand Down

0 comments on commit e0ad139

Please sign in to comment.