AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 33 Bitcoin

Extend functional test for setBlockIndexCandidates UB

Public commit record

What the developer wrote

Authored by marcofleon

83/100 · Strong
Extend functional test for setBlockIndexCandidates UB

Fix the from-disk subtest to use a separate node so it builds on a
clean genesis block, rather than the leftover chain from the
in-memory subtest.

Change from a two-way to a three-way block race. The UB in the old
LoadChainTip (mutating nSequenceId, a sort key, while the block is
in setBlockIndexCandidates) corrupts the internal tree structure,
resulting in a failed erase that leaves stale blocks in the set
alongside the tip. With only two competing blocks, this is caught
by libstdc++ but not by libc++. A three-way split triggers the bug
on both implementations.

To trigger CheckBlockIndex (where the crashing assertion is), replace
the restart loop with sending a new block after a single restart.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit only changes a test file. It improves an existing functional test that exercises a known undefined-behavior bug in Bitcoin Core's block index handling. The test now uses a separate node, creates a three-way block race instead of a two-way race, and triggers the bug more reliably across different C++ standard library implementations. It does not change production code, so it does not fix or introduce a vulnerability by itself.

Recommended action

No immediate action required for this commit. Treat it as a regression-test improvement. Ensure the underlying UB bug in setBlockIndexCandidates handling is tracked and already fixed or scheduled for fixing in production code; if not, prioritize a code fix because the test confirms it is reproducible.

Security signals we found

01

Test-only change extending coverage for known undefined-behavior bug

02

References stale blocks remaining in setBlockIndexCandidates after failed erase

03

References crashing assertion in CheckBlockIndex

04

No production code modification

Risk score

Why this scored 33/100

Our methodology →
Potential impact 8/30
Exploitability 4/25
Stealth signal 6/15
Affected reach 5/15
Confidence 7/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.