summaryrefslogtreecommitdiff
path: root/sha1-file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 13:37:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-13 13:37:17 (GMT)
commit879a8d4bf2412303ec940d69165b0937c11a2851 (patch)
treef610f532a4da757bc9b5480cce825e2e937bbb37 /sha1-file.c
parentfd7761a1cd1d8ab5cb311b6e7f91e56496e95b84 (diff)
parent18ad13e5b2ee18c3f57bf41add3efa95980e72c1 (diff)
downloadgit-879a8d4bf2412303ec940d69165b0937c11a2851.zip
git-879a8d4bf2412303ec940d69165b0937c11a2851.tar.gz
git-879a8d4bf2412303ec940d69165b0937c11a2851.tar.bz2
Merge branch 'jk/detect-truncated-zlib-input'
A regression in Git 2.12 era made "git fsck" fall into an infinite loop while processing truncated loose objects. * jk/detect-truncated-zlib-input: cat-file: handle streaming failures consistently check_stream_sha1(): handle input underflow t1450: check large blob in trailing-garbage test
Diffstat (limited to 'sha1-file.c')
-rw-r--r--sha1-file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1-file.c b/sha1-file.c
index dd0b6aa..2daf7d9 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -2199,7 +2199,8 @@ static int check_stream_sha1(git_zstream *stream,
* see the comment in unpack_sha1_rest for details.
*/
while (total_read <= size &&
- (status == Z_OK || status == Z_BUF_ERROR)) {
+ (status == Z_OK ||
+ (status == Z_BUF_ERROR && !stream->avail_out))) {
stream->next_out = buf;
stream->avail_out = sizeof(buf);
if (size - total_read < stream->avail_out)