Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Assertion failed when parsing incorrect URL containing u200b Unicode character #51593

Closed
heipei opened this issue Jan 29, 2024 · 7 comments
Labels
confirmed-bug Issues with confirmed bugs. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Comments

@heipei
Copy link

heipei commented Jan 29, 2024

Version

v20.10.0

Platform

Linux blackbox 6.7.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 21 Jan 2024 22:14:10 +0000 x86_64 GNU/Linux

Subsystem

url

What steps will reproduce the bug?

Trying to parse this will crash the process instead of throwing an exception. Not sure what would be the intended behavior here:

u = new URL("http://​123.123.123.123")
u.username = ""

The URL contains a u200b unicode character in front of the first digit!

How often does it reproduce? Is there a required condition?

Always reproducible

What is the expected behavior? Why is that the expected behavior?

An exception that can be caught.

What do you see instead?

Process crashes with

node[1296311]: ../src/node_url.cc:309:static void node::url::BindingData::Update(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `out' failed.
 1: 0x604dba5723d5 node::Abort() [node]
 2: 0x604dba572731 node::Assert(node::AssertionInfo const&) [node]
 3: 0x604dba64cd18 node::url::BindingData::Update(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 4: 0x604dba7ec1f6  [node]
 5: 0x604dba7ecd92 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
 6: 0x604dbb160df6  [node]

Additional information

No response

@targos
Copy link
Member

targos commented Jan 29, 2024

@nodejs/url

@marco-ippolito
Copy link
Member

marco-ippolito commented Jan 29, 2024

@anonrig it seems like an issue with ada parse

  auto out = ada::parse<ada::url_aggregator>(input.ToStringView());

@lemire
Copy link
Member

lemire commented Jan 29, 2024

I am checking it.

@lemire
Copy link
Member

lemire commented Jan 29, 2024

It is a bug in ada. See ada-url/ada#583

@anonrig will need to review.

@lemire
Copy link
Member

lemire commented Jan 29, 2024

For people who are curious, we did not have any test with an IPv4 address containing ignorable Unicode characters. This was just an untested code path.

@anonrig anonrig added whatwg-url Issues and PRs related to the WHATWG URL implementation. confirmed-bug Issues with confirmed bugs. labels Jan 29, 2024
@lemire
Copy link
Member

lemire commented Jan 29, 2024

@anonrig has approved my fix and the fix is merged. A new release of ada will be necessary to fix this issue in node.

@targos targos linked a pull request Jan 30, 2024 that will close this issue
@marco-ippolito
Copy link
Member

Fixed on main with #51542, should be included in the next release and backported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. whatwg-url Issues and PRs related to the WHATWG URL implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants