Skip to content

Net: SocketAddress operator < unusable for std::map key #188

@madmaxoft

Description

@madmaxoft

The Poco::Net::SocketAddress::operator < () is flawed, doesn't produce a strict weak ordering and therefore the SocketAddress cannot be used as a key in std::map. There are pairs of addresses for which the expression ((Addr1 < Addr2) && (Addr2 < Addr1)) is true, for example:
Addr1("10.0.0.1:2000");
Addr2("10.0.0.2:1000");

The operator needs to check the components for equality, too, before going to a deeper component.

Found in version 1.4.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions