Re: [PATCH] unpack_sha1_header(): detect malformed object header

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

 



On Mon, Sep 26, 2016 at 10:33:57AM -0700, Junio C Hamano wrote:

> -- >8 --
> From: Junio C Hamano <gitster@xxxxxxxxx>
> Date: Mon, 26 Sep 2016 09:23:41 -0700
> Subject: [PATCH 1/2] streaming: make sure to notice corrupt object
> 
> The streaming read interface from a loose object called
> parse_sha1_header() but discarded its return value, without noticing
> a potential error.
> 
> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
> ---
>  streaming.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/streaming.c b/streaming.c
> index 811fcc2..884a8f1 100644
> --- a/streaming.c
> +++ b/streaming.c
> @@ -347,7 +347,8 @@ static open_method_decl(loose)
>  		return -1;
>  	}
>  
> -	parse_sha1_header(st->u.loose.hdr, &st->size);
> +	if (parse_sha1_header(st->u.loose.hdr, &st->size) < 0)
> +		return -1;

Do you have to git_inflate_end() and munmap() here, as the error path
above does (this was missing from my patch, too)?

-Peff



[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]