tree-diff: don't access hash of NULL object_id pointer
The object_id pointers can be NULL for invalid entries. Don't try to dereference them and pass NULL along to fill_tree_descriptor() instead, which handles them just fine. Found with Clang's UBSan. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
94e327e973
commit
fb04dced9c
@ -422,8 +422,9 @@ static struct combine_diff_path *ll_diff_tree_paths(
|
||||
* diff_tree_oid(parent, commit) )
|
||||
*/
|
||||
for (i = 0; i < nparent; ++i)
|
||||
tptree[i] = fill_tree_descriptor(&tp[i], parents_oid[i]->hash);
|
||||
ttree = fill_tree_descriptor(&t, oid->hash);
|
||||
tptree[i] = fill_tree_descriptor(&tp[i],
|
||||
parents_oid[i] ? parents_oid[i]->hash : NULL);
|
||||
ttree = fill_tree_descriptor(&t, oid ? oid->hash : NULL);
|
||||
|
||||
/* Enable recursion indefinitely */
|
||||
opt->pathspec.recursive = DIFF_OPT_TST(opt, RECURSIVE);
|
||||
|
Loading…
Reference in New Issue
Block a user