Skip to content

fuzz: fix dead HD keypaths (de)serialization round-trip#35481

Merged
sedited merged 1 commit into
bitcoin:masterfrom
theStack:202606-fuzz-fix-deserializehdkeypaths_roundtrip
Jun 7, 2026
Merged

fuzz: fix dead HD keypaths (de)serialization round-trip#35481
sedited merged 1 commit into
bitcoin:masterfrom
theStack:202606-fuzz-fix-deserializehdkeypaths_roundtrip

Conversation

@theStack
Copy link
Copy Markdown
Contributor

@theStack theStack commented Jun 7, 2026

DeserializeHDKeypaths() was writing into the original hd_keypaths map instead of deserialized_hd_keypaths. As a result the latter was always empty and the round-trip assertion following was trivially true, so the serialize/deserialize round-trip wasn't actually being exercised.

That bug was introduced with the commit introducing the fuzz target (commit f898ef6, #18994).

`DeserializeHDKeypaths()` was writing into the original `hd_keypaths`
map instead of `deserialized_hd_keypaths`. As a result the latter was
always empty and the round-trip assertion following was trivially true,
so the serialize/deserialize round-trip wasn't actually being exercised.

That bug was introduced with the commit introducing the fuzz target
(commit f898ef6, bitcoin#18994).
@DrahtBot
Copy link
Copy Markdown
Contributor

DrahtBot commented Jun 7, 2026

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35481.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK sedited

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

Copy link
Copy Markdown
Contributor

@sedited sedited left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5deb053

@sedited sedited merged commit 5f33da9 into bitcoin:master Jun 7, 2026
27 checks passed
@theStack theStack deleted the 202606-fuzz-fix-deserializehdkeypaths_roundtrip branch June 7, 2026 20:29
try {
DeserializeHDKeypaths(serialized, key, hd_keypaths);
DeserializeHDKeypaths(serialized, key, deserialized_hd_keypaths);
} catch (const std::ios_base::failure&) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need the try/catch? Doesn't that kinda' defeat the purpose of a fuzzer?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaict the key can still have a bad size here, which triggers a try/catch, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we guard for that specifically and abort in other cases? Otherwise what's the point of this call, to have fake coverage?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants