Thread (23 messages) 23 messages, 5 authors, 2025-08-20

Potential Null Pointer Dereference detected by static analysis tool

From: Cheng <hidden>
Date: 2025-08-13 07:13:18


line 326 in builtin/describe.cdescribe.c, which is located in the function describe_commit. In the following code, cmit could be NULL passed to the call, which then causes a NULL dereference. Seems should be replaced lookup_commit_reference with lookup_commit_or_die.

cmit = lookup_commit_reference(the_repository, oid);
n = find_commit_name(&cmit->object.oid);
    


The NULL value seems to come from function lookup_commit_reference_gently where:

- 1. call to deref_tag may return NULL.

- 2. call to object_as_type may return NULL.


In this repository,  other calls  lookup_commit_reference are followed by a null check. So this seems to lead to NULL dereference. Can I confirm with you whether this is a true positive bug report?







Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help