From: Johannes Sixt <j.sixt@viscovery.net>
To: Nicolas Pitre <nico@fluxnic.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] index-pack: rationalize unpack_entry_data()
Date: Mon, 12 Apr 2010 08:36:25 +0200 [thread overview]
Message-ID: <4BC2BF69.8050100@viscovery.net> (raw)
In-Reply-To: <1271041047-32563-2-git-send-email-nico@fluxnic.net>
Am 4/12/2010 4:57, schrieb Nicolas Pitre:
> - for (;;) {
> - int ret = git_inflate(&stream, 0);
> - use(input_len - stream.avail_in);
> - if (stream.total_out == size && ret == Z_STREAM_END)
> - break;
> - if (ret != Z_OK)
> - bad_object(offset, "inflate returned %d", ret);
> + do {
> stream.next_in = fill(1);
> stream.avail_in = input_len;
> - }
> + status = git_inflate(&stream, 0);
> + use(input_len - stream.avail_in);
> + } while (status == Z_OK);
> git_inflate_end(&stream);
> + if (stream.total_out != size || status != Z_STREAM_END)
> + bad_object(offset, "inflate returned %d", status);
> return buf;
Is stream.total_out still valid after inflateEnd() (and I mean "valid by
definition", not just "by accident")? To stay on the safe side, you should
call git_inflate_end only after this last check.
-- Hannes
next prev parent reply other threads:[~2010-04-12 6:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-12 2:57 [PATCH 1/2] index-pack: smarter memory usage when resolving deltas Nicolas Pitre
2010-04-12 2:57 ` [PATCH 2/2] index-pack: rationalize unpack_entry_data() Nicolas Pitre
2010-04-12 6:36 ` Johannes Sixt [this message]
2010-04-12 15:47 ` Nicolas Pitre
2010-04-12 6:30 ` [PATCH 1/2] index-pack: smarter memory usage when resolving deltas Johannes Sixt
2010-04-12 15:45 ` Nicolas Pitre
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=4BC2BF69.8050100@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nico@fluxnic.net \
/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;
as well as URLs for NNTP newsgroup(s).