diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-13 16:37:17 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-13 16:37:17 +0300 |
commit | 879a8d4bf2412303ec940d69165b0937c11a2851 (patch) | |
tree | f610f532a4da757bc9b5480cce825e2e937bbb37 /sha1-file.c | |
parent | fd7761a1cd1d8ab5cb311b6e7f91e56496e95b84 (diff) | |
parent | 18ad13e5b2ee18c3f57bf41add3efa95980e72c1 (diff) |
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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1-file.c b/sha1-file.c index dd0b6aa873..2daf7d9935 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) |