url: fix port overflow checking
This patch adds (port > 0xffff)
check after each digit in the loop and prevents integer overflow.
In the current implementation a result can be incorrect if an integer overflow occurs. For example:
const URL = require('url').URL;
const url = new URL("http://example.com:4294967377/");
console.log(url.port);
// actual: 81
// expected: failure (TypeError)
Refs: https://github.com/w3c/web-platform-tests/pull/7602
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
url