]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/zlib-inflate-fixes'
authorJunio C Hamano <gitster@pobox.com>
Tue, 15 Apr 2025 20:50:13 +0000 (13:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Apr 2025 20:50:14 +0000 (13:50 -0700)
Fix our use of zlib corner cases.

* jk/zlib-inflate-fixes:
  unpack_loose_rest(): rewrite return handling for clarity
  unpack_loose_rest(): simplify error handling
  unpack_loose_rest(): never clean up zstream
  unpack_loose_rest(): avoid numeric comparison of zlib status
  unpack_loose_header(): avoid numeric comparison of zlib status
  git_inflate(): skip zlib_post_call() sanity check on Z_NEED_DICT
  unpack_loose_header(): fix infinite loop on broken zlib input
  unpack_loose_header(): report headers without NUL as "bad"
  unpack_loose_header(): simplify next_out assignment
  loose_object_info(): BUG() on inflating content with unknown type

1  2 
git-zlib.c
object-file.c
t/t1006-cat-file.sh

diff --cc git-zlib.c
Simple merge
diff --cc object-file.c
index 4fb3cd9dcb9baf7c4365fbb63a16c434b8787023,e463b4bad3e4bcf1413c9a12fd66b302c50f3e65..8da62fed0b0dacc031b5a7153313b292fa597d12
@@@ -3077,10 -2731,9 +3077,9 @@@ static int check_stream_oid(git_zstrea
                if (size - total_read < stream->avail_out)
                        stream->avail_out = size - total_read;
                status = git_inflate(stream, Z_FINISH);
 -              the_hash_algo->update_fn(&c, buf, stream->next_out - buf);
 +              git_hash_update(&c, buf, stream->next_out - buf);
                total_read += stream->next_out - buf;
        }
-       git_inflate_end(stream);
  
        if (status != Z_STREAM_END) {
                error(_("corrupt loose object '%s'"), oid_to_hex(expected_oid));
Simple merge