Skip to content

Invalid integers used in networking code #441

@hrj

Description

@hrj

While trying to use the websocket code as per #258, I encountered this assertion failure:

Uncaught Error: Assertion failed: Int value is out of bounds: 4026531841

Tracing this backwards, the number comes from src/natives/java_net.ts -> java_net_Inet4AddressImpl:lookupAllHostAddr -> host_allocate_address -> next_address. According to the comment at the beginning of the file:

Doppio returns an unused private IP in the range of 240.0.0.0 to 250.0.0.0 for each unique DNS lookup. Doppio uses this IP as a token for that particular DNS lookup....

These addresses as unsigned integers begin from 0xF0000000. However, Java has only signed integers.

My hunch is that the native code should use signed integers starting from -2^28. Does that make sense?

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