Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Sven Strickroth <email@cs-ware.de>
Cc: git <git@vger.kernel.org>
Subject: Re: zlib 1.4 compatible?
Date: Wed, 11 Nov 2026 14:59:03 +0100	[thread overview]
Message-ID: <avR0pxqREJGwDS86@pks.im> (raw)
In-Reply-To: <9c54aa5a-f359-4db8-a9fd-d86c48b73ff0@cs-ware.de>

On Mon, Nov 09, 2026 at 03:14:27PM +0100, Sven Strickroth wrote:
> Hi,
> 
> zlib 1.4 was released recently to fix security issues, however, at the same
> time it introduces potentially breaking changes (cf.
> <https://github.com/madler/zlib/releases/tag/v1.4>) such as:
> 
> > Raw deflate that completes exactly at the end of the output buffer now
> returns Z_STREAM_END instead of Z_OK, as documented.
> 
> Does this affect glib?

You probably mean Git, not glib.

So this breaking change is only contained to raw deflate, and we only
use that in "archive-zip.c". And as `Z_STREAM_END` can only trigger with
`Z_FINISH` there's only two loops here that we need to vet:

	buffer = xmalloc(maxsize);
        ...

	do {
		result = git_deflate(&stream, Z_FINISH);
	} while (result == Z_OK);

This one shoulud be fine, as we estimate the maximum bounds and then
decompress everything into that buffer. So even when we see Z_STREAM_END
we'd write the results into that buffer as expected.

And the second one:

	if (result != Z_STREAM_END) {
		free(buffer);
		return NULL;
	}

	do {
		result = git_deflate(&zstream, Z_FINISH);
		if (result != Z_OK && result != Z_STREAM_END)
			die("deflate error (%d)", result);

		out_len = zstream.next_out - compressed;
		if (out_len > 0) {
			write_or_die(1, compressed, out_len);
			compressed_size += out_len;
			zstream.next_out = compressed;
			zstream.avail_out = sizeof(compressed);
		}
	} while (result != Z_STREAM_END);

This one looks fine to me, as we process the result just fine on
Z_STREAM_END.

So I don't think that zlib 1.4 causes any issues for us.

Patrick

      reply	other threads:[~2026-11-11 13:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 14:14 zlib 1.4 compatible? Sven Strickroth
2026-11-11 13:59 ` Patrick Steinhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avR0pxqREJGwDS86@pks.im \
    --to=ps@pks.im \
    --cc=email@cs-ware.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox