Skip to content

Conversation

@mumbleskates
Copy link
Contributor

u8 as FromStr tolerates a leading + character, so before this change for any 2-digit component of the path, "05" and "+5" are basically equivalent. we shouldn't tolerate this, it's weird.

Copy link
Contributor

@caspermeijn caspermeijn left a comment

Choose a reason for hiding this comment

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

Good find. Thanks for your contribution!

if s.len() < 2 {
return None;
}
if s.starts_with('+') {
Copy link
Contributor

Choose a reason for hiding this comment

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

The digits.parse function will eventually call u8::from_str_radix, which allows to an optional + and then only digits. So checking for the + as the first character is enough to get all the weird cases of parse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, that seems to be the case!

@caspermeijn caspermeijn added this pull request to the merge queue Jul 13, 2024
Merged via the queue into tokio-rs:master with commit 366c6fb Jul 13, 2024
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.

2 participants