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

Re: [PATCH] builtin/gc.c: fix use-after-free in maintenance_unregister()

From
Taylor Blau <me@ttaylorr.com>
Date
Nov 16, 2022, 20:14 UTC
Message-ID
<Y3VEk5VbAow0bqpS@nand.local>
In-Reply-To
<221116.865yffj5ha.gmgdl@evledraar.gmail.com>
On Wed, Nov 16, 2022 at 04:14:30PM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 13 quoted lines
> >> Copying from other zero-initializations of `struct config_set`:
> >>
> >>     $ git grep -oh 'struct config_set.*= {.*' | sort | uniq -c
> >>           3 struct config_set cs = { { 0 } };
> >
> > Yes, without the double braces the compiler will complain on
> > macOS, I believe.
>
> Ah, that was sorted in 54795d37d9e (config.mak.dev: disable suggest
> braces error on old clang versions, 2022-10-10).
>
> It's fine here, we can follow-up for the #leftoverbits of changing those
> some other time.
Thanks for the reference to 54795d37d9e, Ævar.
There are a small handful of these sitting around in our codebase:
    $ git grep '{ { '
    builtin/gc.c:   struct config_set cs = { { 0 } };
    builtin/worktree.c:             struct config_set cs = { { 0 } };
    oidmap.h:#define OIDMAP_INIT { { NULL } }
    oidset.h:#define OIDSET_INIT { { 0 } }
    reftable/stack_test.c:  struct reftable_ref_record refs[2] = { { NULL } };
    reftable/stack_test.c:  struct reftable_log_record logs[2] = { { NULL } };
    reftable/stack_test.c:  struct reftable_ref_record refs[2] = { { NULL } };
    reftable/stack_test.c:  struct reftable_log_record logs[2] = { { NULL } };
    reftable/stack_test.c:  struct reftable_log_record logs[20] = { { NULL } };
    reset.c:        struct tree_desc desc[2] = { { NULL }, { NULL } };
    t/helper/test-ref-store.c:static struct flag_definition empty_flags[] = { { NULL, 0 } };
    worktree.c:     struct config_set cs = { { 0 } };

But I tend to agree that I'm not all that eager to go and change these for the sake of changing them. I think we can slowly let them age out of the codebase when we're touching nearby areas in the future.

Thanks, Taylor

Previous: Ævar Arnfjörð Bjarmason
Message 8 of 8 in “builtin/gc.c: fix use-after-free in maintenance_unregister()”
  1. builtin/gc.c: fix use-after-free in maintenance_unregister()Taylor Blau, Nov 15, 2022
  2. Derrick StoleeNov 15, 2022
  3. Ævar Arnfjörð BjarmasonNov 15, 2022
  4. Ævar Arnfjörð BjarmasonNov 15, 2022
  5. Taylor BlauNov 15, 2022
  6. Derrick StoleeNov 16, 2022
  7. Ævar Arnfjörð BjarmasonNov 16, 2022
  8. Taylor BlauNov 16, 2022

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.