Skip to content

Return NoData from new_bech32 on empty data part - #292

Closed
SAY-5 wants to merge 1 commit into
rust-bitcoin:masterfrom
SAY-5:fix-new-bech32-empty-data
Closed

Return NoData from new_bech32 on empty data part#292
SAY-5 wants to merge 1 commit into
rust-bitcoin:masterfrom
SAY-5:fix-new-bech32-empty-data

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 27, 2026

Copy link
Copy Markdown

new_bech32 indexes data_part[0] without checking for an empty data part, so parsing "bc1" panics instead of returning an error. This adds the same NoData guard that new already has, with a test covering both constructors.

Fixes #291

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@apoelstra

Copy link
Copy Markdown
Member

Looks like #288 will do the same thing.

@SAY-5

SAY-5 commented Jul 27, 2026

Copy link
Copy Markdown
Author

ah right, #288 covers it. happy to see this closed in favor of that one.

@apoelstra apoelstra closed this Jul 29, 2026
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.

Index-out-of-bounds panic in SegwitHrpstring::new_bech32 on empty data part

2 participants