Re: [PATCH 4/4] format-rev: learn --abbrev, --color, and --date
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 17, 2026, 16:54 UTC
- Message-ID
- <xmqqa4qk661p.fsf@gitster.g>
- In-Reply-To
- <0bd9c642-9e88-4c82-81ee-20fdeb3c2797@app.fastmail.com>
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
Show 16 quoted lines
> static int format_nul_cb(const struct option *option,
> const char *arg,
> int unset)
> {
> struct format_rev_data *data = option->value;
> data->nul_input = 1;
> data->nul_output = 1;
> BUG_ON_OPT_NEG(unset);
> BUG_ON_OPT_ARG(arg);
> return 0;
> }
>
> But this does not have the `NULL` deref. problem since we just
> unconditionally set two boolean values. Still, for readability it’s
> better for these two statements to go at the start. Since they are
> preconditions. I will add this as a patch/commit to the series.Yeah, it would be a good idea to establish the "validate before doing anything with the parameters" pattern.
Thanks.