From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Patrick Steinhardt <ps@pks•im>, git@vger•kernel.org
Subject: Re: [PATCH] bisect: address Coverity warning about potential double free
Date: Tue, 26 Nov 2024 11:29:19 +0900 [thread overview]
Message-ID: <xmqqplmi3eyo.fsf@gitster.g> (raw)
In-Reply-To: <20241125163543.GA13033@coredump.intra.peff.net> (Jeff King's message of "Mon, 25 Nov 2024 11:35:43 -0500")
Jeff King <peff@peff•net> writes:
>> Drop the `else` branch entirely as it seems to be a no-op anyway.
>> Another option might be to instead call `free_commit_list()` on `list`,
>> which is the modified version of `commit_list` and thus wouldn't cause a
>> double free. But as mentioned, I couldn't come up with any case where a
>> passed-in non-NULL list becomes empty, so this shouldn't be necessary.
>> And if it ever does become necessary we'd notice anyway via the leak
>> sanitizer.
>
> Nicely explained.
>
>> Interestingly enough we did not have a single test exercising this
>> branch: all tests pass just fine even when replacing it with a call to
>> `BUG()`. Add a test that exercises it.
>
> Seems reasonable. That test will end up passing an empty list into
> find_bisection(), because everything is UNINTERESTING, and the revision
> machinery's limit_list() removes the UNINTERESTING elements from the
> revs->commits list.
>
> I wondered if a topology more like this:
>
> one
> /
> base--two
>
> could produce something interesting from "rev-list --bisect ^one two".
> But no, we still end up removing all of the uninteresting commits before
> we hit find_bisection(). And anyway, "two" is obviously going to be the
> output, so we know "best" won't be NULL and it won't hit your new code.
>
> So I agree there doesn't seem to be a way to trigger the new code that
> isn't just a noop.
>
> Thanks for fixing this!
Thanks, both of you. Will queue and merge to 'next'.
prev parent reply other threads:[~2024-11-26 2:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 15:56 [PATCH] bisect: address Coverity warning about potential double free Patrick Steinhardt
2024-11-25 16:35 ` Jeff King
2024-11-26 2:29 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqplmi3eyo.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=peff@peff$(echo .)net \
--cc=ps@pks$(echo .)im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox