Skip to content

InternetAddress constructor parsing of ipv6 addresses is more lenient on macOS #41663

@jonahwilliams

Description

@jonahwilliams

Given fe80::ec4:7aff:fecc:ea8f%eno2, on Linux and Windows the InternetAddress constructor will throw an InvalidArgument error. On macOS this value is accepted.

example:

void main() {
  InternetAddress('fe80::ec4:7aff:fecc:ea8f%eno2');
}

on Linux/macOS/Fuchsia/Android) socket_base implementations, the actual parsing of this address is delegated to inet_pton. This function appears to have different behavior on macOS/Linux (Android/Fuchsia not tested), which can be reproduced with the following poorly written C code:

#include <arpa/inet.h>
#include <stdio.h>

int main() {
  char* addr = "fe80::ec4:7aff:fecc:ea8f%eno2";
  char* out;
  printf("%d\n", inet_pton(AF_INET6, addr, &out));
}

This prints 1 on macOS, and 0 on Linux.

Is there a boringssl function Dart could invoke instead of depending on system libraries? Perhaps https://github.com/google/boringssl/blob/master/crypto/x509v3/v3_utl.c#L1126

Dart VM version: 2.9.0-3.0.dev.flutter-b0d35855d8

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-iotype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions