diff options
| author | Yuvraj Singh Chauhan <ysinghcin@gmail.com> | 2026-03-20 17:18:23 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-20 10:48:34 -0700 |
| commit | 753ecf42053b8afa9afcc19726635cc5a080c1bb (patch) | |
| tree | a0f6ca2b522ee53260f2de757760d8b9e5deb60b /compat | |
| parent | 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed (diff) | |
| download | git-753ecf42053b8afa9afcc19726635cc5a080c1bb.tar.xz | |
path-walk: fix NULL pointer dereference in error message
When lookup_tree() or lookup_blob() cannot find a tree entry's object,
'o' is set to NULL via:
o = child ? &child->object : NULL;
The subsequent null-check catches this correctly, but then dereferences
'o' to format the error message:
error(_("failed to find object %s"), oid_to_hex(&o->oid));
This causes a segfault instead of the intended diagnostic output.
Fix this by using &entry.oid instead. 'entry' is the struct name_entry
populated by tree_entry() on each loop iteration and holds the OID of
the failing lookup -- which is exactly what the error should report.
This crash is reachable via git-backfill(1) when a tree entry's object
is absent from the local object database.
Signed-off-by: Yuvraj Singh Chauhan <ysinghcin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
0 files changed, 0 insertions, 0 deletions
