git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] sparse-index: fix uninitialized jump

From
Junio C Hamano <gitster@pobox.com>
Date
May 17, 2021, 21:45 UTC
Message-ID
<xmqqo8d9590q.fsf@gitster.g>
In-Reply-To
<pull.953.git.1621254137590.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 13 quoted lines
> From: Derrick Stolee <dstolee@microsoft.com>
>
> While testing the sparse-index, I verified a test with --valgrind and it
> complained about an uninitialized value being used in a jump in the
> path_matches_pattern_list() method. The line was this one:
>
> 	if (*dtype == DT_UNKNOWN)
>
> In the call stack, the culprit was the initialization of the dtype
> variable in convert_to_sparse_rec().
>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
Looks good.
Show 22 quoted lines
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-953%2Fderrickstolee%2Fsparse-index%2Funinitialized-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-953/derrickstolee/sparse-index/uninitialized-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/953
>
>  sparse-index.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sparse-index.c b/sparse-index.c
> index b0d5dc5f081b..affc4048f279 100644
> --- a/sparse-index.c
> +++ b/sparse-index.c
> @@ -34,7 +34,7 @@ static int convert_to_sparse_rec(struct index_state *istate,
>  	int i, can_convert = 1;
>  	int start_converted = num_converted;
>  	enum pattern_match_result match;
> -	int dtype;
> +	int dtype = DT_UNKNOWN;
>  	struct strbuf child_path = STRBUF_INIT;
>  	struct pattern_list *pl = istate->sparse_checkout_patterns;
>  
>
> base-commit: bf949ade81106fbda068c1fdb2c6fd1cb1babe7e
Previous: Derrick Stolee via GitGitGadget
Message 2 of 2 in “sparse-index: fix uninitialized jump”
  1. sparse-index: fix uninitialized jumpDerrick Stolee via GitGitGadget, May 17, 2021
  2. Junio C HamanoMay 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.