Re: [PATCH 2/2] index-pack: rationalize unpack_entry_data()

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

 



Am 4/12/2010 4:57, schrieb Nicolas Pitre:
> -	for (;;) {
> -		int ret = git_inflate(&stream, 0);
> -		use(input_len - stream.avail_in);
> -		if (stream.total_out == size && ret == Z_STREAM_END)
> -			break;
> -		if (ret != Z_OK)
> -			bad_object(offset, "inflate returned %d", ret);
> +	do {
>  		stream.next_in = fill(1);
>  		stream.avail_in = input_len;
> -	}
> +		status = git_inflate(&stream, 0);
> +		use(input_len - stream.avail_in);
> +	} while (status == Z_OK);
>  	git_inflate_end(&stream);
> +	if (stream.total_out != size || status != Z_STREAM_END)
> +		bad_object(offset, "inflate returned %d", status);
>  	return buf;

Is stream.total_out still valid after inflateEnd() (and I mean "valid by
definition", not just "by accident")? To stay on the safe side, you should
call git_inflate_end only after this last check.

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