git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 3, 2026, 07:52 UTC
Message-ID
<apknMr9Jk-CzdLAR@pks.im>
In-Reply-To
<20260903063657.2067303-1-zkd18cjb@mail.ustc.edu.cn>
On Thu, Sep 03, 2026 at 02:36:57PM +0800, Jinbao Chen wrote:
Show 17 quoted lines
> 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 <zkd18cjb@mail.ustc.edu.cn>
> ---
> 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
Previous: Jinbao Chen
Message 4 of 4 in “history: do not dereference NULL when parent tree is missing”
  1. history: do not dereference NULL when parent tree is missingzkd18cjb@mail.ustc.edu.cn, Sep 2, 2026
  2. Patrick SteinhardtSep 3, 2026
  3. Jinbao ChenSep 3, 2026
  4. Patrick SteinhardtSep 3, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.