git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: "Dana How" <danahow@gmail.com>
Cc: "Junio C Hamano" <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH 02/13] declare overflow during base128 decoding when 1 MSB nonzero, not 7
Date: Thu, 05 Apr 2007 15:51:36 -0700	[thread overview]
Message-ID: <7vr6qymo3r.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <56b7f5510704051524p28eafc18mae3131ef13cdabfa@mail.gmail.com> (Dana How's message of "Thu, 5 Apr 2007 15:24:49 -0700")

"Dana How" <danahow@gmail.com> writes:

> Subject: [PATCH 02/13] declare overflow during base128 decoding when 1 MSB nonzero, not 7
>
> ---
>  builtin-pack-objects.c   |    2 +-
>  builtin-unpack-objects.c |    2 +-
>  index-pack.c             |    2 +-
>  sha1_file.c              |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
> index b5f9648..50246e1 100644
> --- a/builtin-pack-objects.c
> +++ b/builtin-pack-objects.c
> @@ -1014,7 +1014,7 @@ static void check_object(struct object_entry *entry)
>  				ofs = c & 127;
>  				while (c & 128) {
>  					ofs += 1;
> -					if (!ofs || ofs & ~(~0UL >> 7))
> +					if (!ofs || ofs & ~(~0UL >> 1))
>  						die("delta base offset overflow in pack for %s",
>  						    sha1_to_hex(entry->sha1));
>  					c = buf[used_0++];

The line after these context does this:

	ofs = (ofs << 7) + (c & 127);

If you do not check the top 7 bits, wouldn't you miss overflow?

  reply	other threads:[~2007-04-05 22:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05 22:24 [PATCH 02/13] declare overflow during base128 decoding when 1 MSB nonzero, not 7 Dana How
2007-04-05 22:51 ` Junio C Hamano [this message]
2007-04-05 23:08   ` Dana How
2007-04-06  0:29     ` Junio C Hamano
2007-04-06  0:35 ` Nicolas Pitre
2007-04-06  0: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=7vr6qymo3r.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=danahow@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).