All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Marco Costalba" <mcostalba@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: [PATCH decompress BUG] Fix decompress_next_from() wrong argument value
Date: Fri, 11 Jan 2008 23:31:43 -0800	[thread overview]
Message-ID: <7vir1zwlcw.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <e5bfff550801112306g6b8127dft80484c9fd8554992@mail.gmail.com> (Marco Costalba's message of "Sat, 12 Jan 2008 08:06:35 +0100")

"Marco Costalba" <mcostalba@gmail.com> writes:

> The only two points in the current code in master that I would like to
> report to you are a _possible_ missing inflateEnd() before a new
> inflateInit(), but I am not confident with that part of code to judge
> if is a bug or not, anyway that's the _possible_ diff.
>
> diff --git a/http-push.c b/http-push.c
> index 55d0c94..e0a4cc6 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -307,6 +307,7 @@ static void start_fetch_loose(struct
> transfer_request *request)
>  	/* Reset inflate/SHA1 if there was an error reading the previous temp
>  	   file; also rewind to the beginning of the local file. */
>  	if (prev_read == -1) {
> +		inflateEnd(&request->stream);
>  		memset(&request->stream, 0, sizeof(request->stream));
>  		inflateInit(&request->stream);
>  		SHA1_Init(&request->c);

I think this could leak if request->stream already had
something in it, but I do not see anything that is done to it
after it is initialized and the code reaches to this point.

In fact, I suspect that it would make more sense to remove the
earlier memset() that clears request->stream and inflateInit(),
and moving the memset() and inflateInit() we see above out of
that if clause (before checking prev_read).

The same comment applies to the other hunk.

By the way, I was looking at the earlier two series from you
(compress and decompress), and noticed some of them were corrupt
with linewrap.  As I think they are good clean-up patches, I'd
like to apply them as one of the first series post 1.5.4.  As
such, this request is not urgent at all, but please resend with
a clean-up when 'master'/'next' reopens.

Thanks.

  reply	other threads:[~2008-01-12  7:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 20:47 [PATCH decompress BUG] Fix decompress_next_from() wrong argument value Marco Costalba
2008-01-12  0:16 ` Junio C Hamano
2008-01-12  7:06   ` Marco Costalba
2008-01-12  7:31     ` Junio C Hamano [this message]
2008-01-12  7:42       ` Marco Costalba
2008-01-12 18:44         ` Junio C Hamano

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=7vir1zwlcw.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mcostalba@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.