]> git.ipfire.org Git - thirdparty/git.git/commit
describe: pass commit to describe_commit()
authorJeff King <peff@peff.net>
Mon, 18 Aug 2025 21:04:17 +0000 (17:04 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Aug 2025 16:08:57 +0000 (09:08 -0700)
commit7c10e48e81ae63974e3badf3b7df71df74a0640b
tree4c7de042dad6c239f99efa7d99771d4a143b9994
parent8cfd4ac215e3711757acef8043c1c3bf3689f606
describe: pass commit to describe_commit()

There's a call in describe_commit() to lookup_commit_reference(), but we
don't check the return value. If it returns NULL, we'll segfault as we
immediately dereference the result.

In practice this can never happen, since all callers pass an oid which
came from a "struct commit" already. So we can make this more obvious
by just taking that commit struct in the first place.

Reported-by: Cheng <prophecheng@stu.pku.edu.cn>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/describe.c