From: "Shawn O. Pearce" <spearce@spearce.org>
To: Tay Ray Chuan <rctay89@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] remote-curl.c: fix rpc_out()
Date: Mon, 23 Nov 2009 13:04:15 -0800 [thread overview]
Message-ID: <20091123210415.GH11919@spearce.org> (raw)
In-Reply-To: <20091123110338.2b230359.rctay89@gmail.com>
If I understand the change right, the only thing that really matters
here is removing the extra ';' in the if (max < avail) condition.
That bug was the only reason why rpc->len < rpc->pos, and is thus
the only reason why avail would "go negative" (which it can't do
since its unsigned, it just wrapped around to a massive value).
Tay Ray Chuan <rctay89@gmail.com> wrote:
> Use comparisons between rpc->len and rpc->pos, rather than computing
> their difference. This avoids potential errors when this value is
> negative and we access it.
I don't see this as being very relevant here.
> Use an int to store the return value from packet_read_line(), instead
> of a size_t.
Why? The code is actually harder to follow. packet_read_line does
not return a negative value.
> Handle the errorneous condition where rpc->pos exceeds rpc->len by
> printing a message and aborting the transfer (return 0).
This condition should be impossible. It only occurred because of
the bug you were trying to fix, which is this one next item:
> Remove extraneous semicolon (';') at the end of the if statement, that
> prevented code in its block from executing.
Right. This bug is really bad and should be fixed. But the message
above make this some little after-thought and doesn't explain what
was wrong with this being here.
> ---
>
> Users might experience issues when pushing with chunked encoding when
> size_t avail is negative.
Shouldn't this be in the commit message? Or something about how
pushing with chunked encoding was broken if the push was larger
than the default buffer size of 1 MiB?
--
Shawn.
next prev parent reply other threads:[~2009-11-23 21:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 3:03 [PATCH 2/2] remote-curl.c: fix rpc_out() Tay Ray Chuan
2009-11-23 5:53 ` Sverre Rabbelier
2009-11-23 8:38 ` Tay Ray Chuan
2009-11-23 10:39 ` Johannes Schindelin
2009-11-23 17:54 ` Tay Ray Chuan
2009-11-23 21:04 ` Shawn O. Pearce [this message]
2009-11-24 1:35 ` Tay Ray Chuan
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=20091123210415.GH11919@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rctay89@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 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).