summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-03 09:34:28 -0700
committerJunio C Hamano <gitster@pobox.com>2013-04-03 09:34:29 -0700
commitb9c78e97237df7df45549d29755e51b4a0fdc5ea (patch)
tree2bc749c7d16c66bfd3289f8813a7395c2867f509 /sha1_file.c
parenta70f4cb5b06856d5999352930b97fdfc96105954 (diff)
parentd3b34622f699ff14646de4ec1b1ab9afb0bcb056 (diff)
downloadgit-b9c78e97237df7df45549d29755e51b4a0fdc5ea.tar.gz
Merge branch 'jk/check-corrupt-objects-carefully'
Have the streaming interface and other codepaths more carefully examine for corrupt objects. * jk/check-corrupt-objects-carefully: clone: leave repo in place after checkout errors clone: run check_everything_connected clone: die on errors from unpack_trees add tests for cloning corrupted repositories streaming_write_entry: propagate streaming errors add test for streaming corrupt blobs avoid infinite loop in read_istream_loose read_istream_filtered: propagate read error from upstream check_sha1_signature: check return value from read_istream stream_blob_to_fd: detect errors reading from stream
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 5f573d9b81..0ed23981b3 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1271,6 +1271,10 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
char buf[1024 * 16];
ssize_t readlen = read_istream(st, buf, sizeof(buf));
+ if (readlen < 0) {
+ close_istream(st);
+ return -1;
+ }
if (!readlen)
break;
git_SHA1_Update(&c, buf, readlen);