Commit 9fb44f4
committed
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>1 parent 3420d35 commit 9fb44f4
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
| 1064 | + | |
| 1065 | + | |
1064 | 1066 | | |
1065 | 1067 | | |
1066 | 1068 | | |
| |||
1387 | 1389 | | |
1388 | 1390 | | |
1389 | 1391 | | |
| 1392 | + | |
| 1393 | + | |
1390 | 1394 | | |
1391 | 1395 | | |
1392 | 1396 | | |
| |||
1421 | 1425 | | |
1422 | 1426 | | |
1423 | 1427 | | |
| 1428 | + | |
| 1429 | + | |
1424 | 1430 | | |
1425 | 1431 | | |
1426 | 1432 | | |
| |||
1433 | 1439 | | |
1434 | 1440 | | |
1435 | 1441 | | |
| 1442 | + | |
| 1443 | + | |
1436 | 1444 | | |
1437 | 1445 | | |
1438 | 1446 | | |
| |||
1447 | 1455 | | |
1448 | 1456 | | |
1449 | 1457 | | |
| 1458 | + | |
| 1459 | + | |
1450 | 1460 | | |
1451 | 1461 | | |
1452 | 1462 | | |
| |||
1486 | 1496 | | |
1487 | 1497 | | |
1488 | 1498 | | |
| 1499 | + | |
| 1500 | + | |
1489 | 1501 | | |
1490 | 1502 | | |
1491 | 1503 | | |
| |||
0 commit comments