diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-13 14:37:17 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-13 14:37:17 +0100 |
commit | 879a8d4bf2412303ec940d69165b0937c11a2851 (patch) | |
tree | f610f532a4da757bc9b5480cce825e2e937bbb37 /sha1-file.c | |
parent | Merge branch 'nd/config-split' (diff) | |
parent | Adjust for 2.19.x series (diff) | |
download | git-879a8d4bf2412303ec940d69165b0937c11a2851.tar.xz git-879a8d4bf2412303ec940d69165b0937c11a2851.zip |
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) |