psbt: Fix bug in Subtype consensus_encode#3519
Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom Oct 29, 2024
Merged
Conversation
In rust-bitcoin#2906 we switched from using a `u8` for type keys to using a `u64` and encoding as a compact int (inline with the spec). Note that a `u8` encodes to the same bytes as a `u64` when the value is < 252. In that patch, I introduced a bug because the length returned by `PoprietaryKey::consensus_encode` uses a hard code 1 for the length of the encoding (because of single byte) instead of the variable length for the new compact encoding. Bug showed up in fuzzing, and was isolated by Jamil - mad props.
Member
Author
jamillambert
approved these changes
Oct 28, 2024
Contributor
jamillambert
left a comment
There was a problem hiding this comment.
Fixes the bug and I get no Fuzz errors locally.
ACK c89b816
Member
Author
|
BOOM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #2906 we switched from using a
u8for type keys to using au64and encoding as a compact int (inline with the spec). Note that au8encodes to the same bytes as au64when the value is < 252.In that patch, I introduced a bug because the length returned by
PoprietaryKey::consensus_encodeuses a hard code 1 for the length of the encoding (because of single byte) instead of the variable length for the new compact encoding.Bug showed up in fuzzing, and was isolated by Jamil - mad props.
Fix: #3501