mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:47:36 +00:00
wallet: guard null coin control in AvailableCoins TRUC filter #36859
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36859
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-10-fuzz-spend-availablecoins-null-coincontrol"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AvailableCoins() takes an optional CCoinControl pointer that defaults to nullptr, and the other uses of it check for null first. The TRUC version filter added in
github.com/bitcoin/bitcoin@ec2676becddoes not, so a call without coin control dereferences a null pointer as soon as the wallet has an unconfirmed output in the mempool.Found this issue with few seconds of fuzzing with the change in the second commit which adds wallet transactions in the mempool state with a fuzzed version, and call
AvailableCoins()directly with an optional null coin control.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
No conflicts as of last run.
🔵 Suggestion · Null-coin-control test leaves coin membership unchecked
The regression test exercises the null call but would also pass a fix that drops all unconfirmed outputs or skips the intended non-TRUC filtering.
Location:
src/wallet/test/spend_tests.cpp:88(head).🔵 Suggestion · Direct fuzz call leaves TRUC result invariants unchecked
With unsafe inputs enabled, the new fuzz fixture could check TRUC output membership and the single-transaction restriction, but discarding the result leaves those invariants unchecked.
Location:
src/wallet/test/fuzz/spend.cpp:108(head).Review coverage was incomplete.
Reviewed:
032be32485d6· Review report · Previous reportspermalink
Concept ACK
tACK
032be32485Tested on Ubuntu.
Left one non-blocking nit inline
nit: The
CreateAndProcessBlockline might be unnecessary, the block's coinbase is already spendable and mature at height 100, and without this line, the test still crashes and passes too. Was this on purpose?nit: Without the
BOOST_CHECK_NO_THROWwrap, the test still crashes without the fix and passes with it. I think that's because null dereference isn't an exception, so it wouldn't be caught. You could consider checking the results ofAvailableCoinsinstead, like the size.(I checked the size was 1 locally)
tACK
032be32485tested both the unit test and the fuzz test individually, they crashed without the fix and passed with it. I left two non-blocking inline comments.
Also, I replayed the existing qa-assets corpus and noticed less coverage on this PR compared to master (cov 19380 → 18366, ft 109275 → 67187 on my machine). Since the new
ConsumeBool()calls change how the inputs are read, the corpus may need regenerating.