multi: Limit inputs to base58 decode.#2860
Merged
davecgh merged 4 commits intodecred:masterfrom Jan 1, 2022
Merged
Conversation
dnldd
approved these changes
Dec 29, 2021
rstaudt2
approved these changes
Dec 31, 2021
6bc5aa9 to
e002538
Compare
dajohi
approved these changes
Dec 31, 2021
This modifies DecodeAddressV0 to reject any attempts to decode strings that are larger than the max possible size early since there is no reason to waste time and memory doing the base 58 decode when it is guaranteed to be invalid anyway. It also adds an associated test to ensure proper functionality.
This modifies NewKeyFromString to reject any attempts to decode strings that are larger than the max possible size early since there is no reason to waste time and memory doing the base 58 decode when it is guaranteed to be invalid anyway. It also adds an associated test to ensure proper functionality.
This reworks the WIF tests to provide full coverage for both positive and negative paths, to test for the explicit reason for the failure to ensure that each test is actually testing the intended condition, and to make them more consistent with modern practices in the code.
This modifies DecodeWIF to reject any attempts to decode strings that are larger than the max possible size early since there is no reason to waste time and memory doing the base 58 decode when it is guaranteed to be invalid anyway. It also adds an associated test to ensure proper functionality.
e002538 to
2e8abf6
Compare
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.
This modifies the following funcs that accept inputs which ultimately involve base58 decoding to reject any attempts to decode strings that are larger than the max possible size early since there is no reason to waste time and memory doing the base 58 decode when it is guaranteed to be invalid anyway:
stdaddr.DecodeAddressV0hdkeychain.NewKeyFromStringdcrutil.DecodeWIFIt also adds associated tests to ensure proper functionality and includes a rework of the WIF tests in
dcrutilto provide full coverage for both positive and negative paths, to test for the explicit reason for the failure to ensure that each test is actually testing the intended condition, and to make them more consistent with modern practices in the code.