Re: [PATCH 02/13] declare overflow during base128 decoding when 1 MSB nonzero, not 7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Dana How" <danahow@xxxxxxxxx> 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?

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]