From: Junio C Hamano Date: Wed, 21 Nov 2018 13:57:52 +0000 (+0900) Subject: Merge branch 'jk/detect-truncated-zlib-input' into maint X-Git-Tag: v2.19.2~38 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d75c41b2ae0a4d5dc40af5e7b84afed791bf77c3?hp=-c Merge branch 'jk/detect-truncated-zlib-input' into maint 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 --- d75c41b2ae0a4d5dc40af5e7b84afed791bf77c3 diff --combined sha1-file.c index 2edf4564f6,6d6c3af659..03b86aec71 --- a/sha1-file.c +++ b/sha1-file.c @@@ -1317,7 -1317,7 +1317,7 @@@ int oid_object_info_extended(struct rep * TODO Pass a repository struct through fetch_object, * such that arbitrary repositories work. */ - fetch_object(repository_format_partial_clone, real->hash); + fetch_objects(repository_format_partial_clone, real, 1); already_retried = 1; continue; } @@@ -2191,7 -2191,8 +2191,8 @@@ static int check_stream_sha1(git_zstrea * 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)