Skip to content

Conversation

@tniessen
Copy link
Member

Refs: #46410

@tniessentniessen added whatwg-url Issues and PRs related to the WHATWG URL implementation. fast-track PRs that do not need to wait for 48 hours to land. labels Feb 7, 2023
@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Feb 7, 2023
@github-actions
Copy link
Contributor

Fast-track has been requested by @tniessen. Please 👍 to approve.

@tniessentniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 7, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 7, 2023
@nodejs-github-bot
Copy link
Collaborator

};

voidSetArgs(Environment* env, Local<Value> argv[12], const ada::result& url){
voidSetArgs(Environment* env, Local<Value> argv[13], const ada::result& url){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array arguments decay to pointers so this, in the abstract, doesn't fix anything. You could change it to:

Suggested change
voidSetArgs(Environment* env, Local<Value> argv[13], const ada::result& url){
voidSetArgs(Environment* env, Local<Value> (*argv)[13], const ada::result& url){

That forces callers to pass a 13-element array by address, i.e.:

Local<Value> argv[13]; SetArgs(env, &argv, url);

You'll need to update all the assignments from argv[0] to (*argv)[0].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For education purposes: How did the code work before this change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wrote past the end. Array arguments aren't length-checked; to the compiler int x[42] equals int x[] equals int *x.

@anonrig
Copy link
Member

cc @nodejs/url

@panvapanva removed the fast-track PRs that do not need to wait for 48 hours to land. label Feb 23, 2023
@tniessen
Copy link
MemberAuthor

Seems like #46736 implicitly overwrote this.

@tniessentniessen closed this Mar 2, 2023
@TimothyGu
Copy link
Member

I believe @bnoordhuis's comment above is still relevant though. @anonrig is there any chance you could pick it up in a future PR?

@anonrig
Copy link
Member

I believe @bnoordhuis's comment above is still relevant though. @anonrig is there any chance you could pick it up in a future PR?

I agree. I'll open a PR. Thanks for the mention.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.whatwg-urlIssues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@tniessen@nodejs-github-bot@anonrig@TimothyGu@bnoordhuis@panva