Skip to content

qt: fix out-of-bounds read in RPCParseCommandLine on empty command#944

Open
nabhan06 wants to merge 1 commit into
bitcoin-core:masterfrom
nabhan06:rpcconsole-empty-stack-oob
Open

qt: fix out-of-bounds read in RPCParseCommandLine on empty command#944
nabhan06 wants to merge 1 commit into
bitcoin-core:masterfrom
nabhan06:rpcconsole-empty-stack-oob

Conversation

@nabhan06

@nabhan06 nabhan06 commented Jul 3, 2026

Copy link
Copy Markdown

When a console line begins with ) or is just an empty pair of brackets, RPCParseCommandLine reaches the command-execution branch while the current argument frame is still empty, so stack.back()[0] reads out of bounds and the argument list built from stack.back().begin() + 1 to end() is an invalid iterator range (throws std::length_error in practice, and UBSan flags the null-pointer reference otherwise). The ( branch already guards this with stack.back().size() > 0, so I apply the same check to the ) and newline branch. Added two regression cases to rpcNestedTests that abort without the guard and pass with it.

@DrahtBot

DrahtBot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK RandyMcMillan

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

@RandyMcMillan

Copy link
Copy Markdown
Contributor

Concept ACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants