Thread (4 messages) flat view 4 messages, 2 authors, 4d ago

Re: [PATCH v2] history: do not dereference NULL when parent tree is missing

From: Patrick Steinhardt <hidden>
Date: 2026-09-03 07:52:31

On Thu, Sep 03, 2026 at 02:36:57PM +0800, Jinbao Chen wrote:
write_ondisk_index() dereferences the return value of
repo_parse_tree_indirect() unconditionally.  If the parent commit's
tree object is missing from the object store (corrupt repository,
object removed by tooling, or incomplete restore), the function
returns NULL and "git history split" crashes with a SIGSEGV.

Guard the parse result and error out gracefully, following the
codebase convention for objects that cannot be loaded.

Signed-off-by: Jinbao Chen <redacted>
---
Thanks for the review!

Changes since v1 (no functional changes):
- Dropped the parenthetical note about the UBSan diagnostic from the
  commit message, as suggested.
- Sent with the From address matching the Signed-off-by.
Thanks, this version looks good to me!

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