"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: plug memory leak in got_pack_dump_delt_chain_to_file()
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 13 Feb 2024 20:47:41 +0100

Download raw body.

Thread
On Tue, Feb 13, 2024 at 08:13:26PM +0100, Omar Polo wrote:
> found by smatch; ok?

yes, ok

> diff -s /home/op/w/got
> commit - 06bd8ee415aa89adaeb49825ad96dfe83554b77e
> path + /home/op/w/got (staged changes)
> blob - f347f506f5945b7404cc0c48620474bfe6f179a5
> blob + c5c1be69a232bf7e5a17ad4a0e06d81efbc1d8f8
> --- lib/pack.c
> +++ lib/pack.c
> @@ -1466,12 +1466,13 @@ got_pack_dump_delta_chain_to_file(size_t *result_size,
>  				accum_bufsz = max_size;
>  				if (pack->map) {
>  					if (delta_data_offset > SIZE_MAX) {
> -						return got_error_fmt(
> +						err = got_error_fmt(
>  						    GOT_ERR_RANGE,
>  						    "delta offset %lld "
>  						    "overflows size_t",
>  						    (long long)
>  						    delta_data_offset);
> +						goto done;
>  					}
>  
>  					mapoff = delta_data_offset;
> 
>