summaryrefslogtreecommitdiffstats
path: root/rerere.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2024-02-05 15:35:53 +0100
committerJunio C Hamano <gitster@pobox.com>2024-02-06 19:42:28 +0100
commit568459bf5e97a4f61429e3bdd1f97b54b39a1383 (patch)
tree7b17660c5d8aecf25dc3060c5c80ffa19d7b22c1 /rerere.c
parentGit 2.43 (diff)
downloadgit-568459bf5e97a4f61429e3bdd1f97b54b39a1383.tar.xz
git-568459bf5e97a4f61429e3bdd1f97b54b39a1383.zip
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>
Diffstat (limited to 'rerere.c')
-rw-r--r--rerere.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/rerere.c b/rerere.c
index 09e1941285..5d79cc4211 100644
--- a/rerere.c
+++ b/rerere.c
@@ -975,6 +975,9 @@ static int handle_cache(struct index_state *istate,
mmfile[i].ptr = repo_read_object_file(the_repository,
&ce->oid, &type,
&size);
+ if (!mmfile[i].ptr)
+ die(_("unable to read %s"),
+ oid_to_hex(&ce->oid));
mmfile[i].size = size;
}
}