Always check the return value of repo_read_object_file()
There are a couple of places in Git's source code where the return value is not checked. As a consequence, they are susceptible to segmentation faults. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
564d0252ca
commit
568459bf5e
@ -575,6 +575,8 @@ static int grep_cache(struct grep_opt *opt,
|
||||
|
||||
data = repo_read_object_file(the_repository, &ce->oid,
|
||||
&type, &size);
|
||||
if (!data)
|
||||
die(_("unable to read tree %s"), oid_to_hex(&ce->oid));
|
||||
init_tree_desc(&tree, data, size);
|
||||
|
||||
hit |= grep_tree(opt, pathspec, &tree, &name, 0, 0);
|
||||
|
Reference in New Issue
Block a user