Commit 1ea1e0e
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 9a7ea25 commit 1ea1e0e
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1054 | 1054 | | |
1055 | 1055 | | |
1056 | 1056 | | |
| 1057 | + | |
| 1058 | + | |
1057 | 1059 | | |
1058 | 1060 | | |
1059 | 1061 | | |
| |||
1380 | 1382 | | |
1381 | 1383 | | |
1382 | 1384 | | |
| 1385 | + | |
| 1386 | + | |
1383 | 1387 | | |
1384 | 1388 | | |
1385 | 1389 | | |
| |||
1414 | 1418 | | |
1415 | 1419 | | |
1416 | 1420 | | |
| 1421 | + | |
| 1422 | + | |
1417 | 1423 | | |
1418 | 1424 | | |
1419 | 1425 | | |
| |||
1426 | 1432 | | |
1427 | 1433 | | |
1428 | 1434 | | |
| 1435 | + | |
| 1436 | + | |
1429 | 1437 | | |
1430 | 1438 | | |
1431 | 1439 | | |
| |||
1440 | 1448 | | |
1441 | 1449 | | |
1442 | 1450 | | |
| 1451 | + | |
| 1452 | + | |
1443 | 1453 | | |
1444 | 1454 | | |
1445 | 1455 | | |
| |||
1479 | 1489 | | |
1480 | 1490 | | |
1481 | 1491 | | |
| 1492 | + | |
| 1493 | + | |
1482 | 1494 | | |
1483 | 1495 | | |
1484 | 1496 | | |
| |||
0 commit comments