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

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
Re: got backout: segfault
To:
Sebastien Marie <semarie@online.fr>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 7 Feb 2020 11:43:39 -0700

Download raw body.

Thread
On Fri, Feb 07, 2020 at 10:37:39AM -0700, Tracey Emery wrote:
> 
> A NULL path is being sent to update_progress. Not sure if this should
> return an error or just NULL here.
> 
> -- 
> 
> Tracey Emery
> 
> diff 992eb9d8966327c12d7e3812a2cae527f621e4ba /home/basepr1me/src/got
> blob - 4329f781964bc8101d3f2bf6cb34c09f6836eee1
> file + got/got.c
> --- got/got.c
> +++ got/got.c
> @@ -1171,6 +1171,9 @@ update_progress(void *arg, unsigned char status, const
>  	if (status == GOT_STATUS_BUMP_BASE)
>  		return NULL;
>  
> +	if (path == NULL)
> +		return NULL;
> +
>  	while (path[0] == '/')
>  		path++;
>  	printf("%c  %s\n", status, path);

Walking it a back further, null is passed from the callback to the
update_progress. Again, still not sure what direction this should take,
so, I'll leave the decisions up to stsp! :D

-- 

Tracey Emery

diff 992eb9d8966327c12d7e3812a2cae527f621e4ba /home/basepr1me/src/got
blob - 17a07a2e89038439f7620a85b41050549a954ea8
file + lib/worktree.c
--- lib/worktree.c
+++ lib/worktree.c
@@ -2108,6 +2108,8 @@ merge_file_cb(void *arg, struct got_blob_object *blob1
 	} else if (blob1) {
 		ie = got_fileindex_entry_get(a->fileindex, path1,
 		    strlen(path1));
+		if (path2 == NULL)
+			path2 = strdup("/dev/null");
 		if (ie == NULL)
 			return (*a->progress_cb)(a->progress_arg,
 			    GOT_STATUS_MISSING, path2);