Skip to content

Ipv4Addr can't parse perfectly valid IP address #100749

Closed
@ghost

Description

I tried this code:

"0xac.000000000000000000331.0246.174".parse::<Ipv4Addr>.unwrap()

I expected to see this happen: OK

Instead, this happened: It panicked and failed.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=278845b668106e1318e431ba7c81eb47


IP addresses can contain different representations in every chunk, the IP address is completely valid. For eg. running ping on it, is completely fine.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions