]> git.ipfire.org Git - thirdparty/git.git/commit
bisect: check get_terms return at all call sites
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 14 Jul 2026 22:48:43 +0000 (22:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2026 01:02:02 +0000 (18:02 -0700)
commit03c660f9e2d0d040decd63637bf2aea6cba296ff
tree84cefad472103af2d2d2cfa218aacde75ef6b4e8
parentbd97cddf278f81189487e742db2f394d94163764
bisect: check get_terms return at all call sites

Six callers of get_terms() silently discard its return value. When
get_terms fails (missing or truncated BISECT_TERMS file), the term
strings remain NULL or empty, causing confusing downstream
behavior: commands like "bisect next" or "bisect run" proceed with
empty term strings, producing nonsensical ref names (refs/bisect/
with no suffix) and misleading error messages.

Add checks at each call site so that a failed get_terms produces a
clear "no terms defined" error, matching the pattern already used
in bisect_terms() at line 512. The check tests the term pointers
rather than the return value because some callers (bisect skip,
legacy bad/good) call set_terms before get_terms, and the
set_terms values should survive a get_terms failure.

Pointed out by Coverity.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/bisect.c