Skip to content

ecdsa: remove unnecessary check in FromStr impl#1255

Open
newpavlov wants to merge 1 commit intomasterfrom
ecdsa/hex_check
Open

ecdsa: remove unnecessary check in FromStr impl#1255
newpavlov wants to merge 1 commit intomasterfrom
ecdsa/hex_check

Conversation

@newpavlov
Copy link
Member

We already check that hex.len() == C::FieldBytesSize::USIZE * 4, so split_at should not panic and any invalid strings should be properly handled by parses.

@newpavlov newpavlov requested a review from tarcieri March 16, 2026 16:08
@newpavlov
Copy link
Member Author

newpavlov commented Mar 16, 2026

We could harden the hex.len() check to account for potential overflow by using hex.len() % 4 != 0 || hex.len() / 4 != C::FieldBytesSize::USIZE, but I am not sure it's worth the trouble since it only matters for impractical values of C bigger than usize::MAX / 4.

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.

1 participant