-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add assertion checking if too many args are passed into exports. #21349
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
Conversation
I'm guessing this will pick up some failures in other places... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I wonder if we will see any tests fail because of this :)
There could be some cases where a developer might be relying on the VM to automatically inject zero values for missing arguments.. so it might be safer to only report too many arguments and not too few?
4580001
to
05f118b
Compare
Looks like a number of tests fail where we rely on that behavior. I'll change it to just check for too many arguments. |
I know ASYNCIFY relies on this.. was there anything else? |
I've looked through a few and it seems the majority come from |
We could try to fix them to be "more correct", but code size could be worse and it would change the behavior of existings APIs. Any thoughts? |
Is that because the entry point for a pthread sometimes has zero args and sometimes as 1 argument? I think that is hard to work around sadly :( Luckily the zero arg form is technically undefined behaviour so we could just disallow that. |
I don't think its worth adding complexity but perhaps there are some cases that are actually bugs. |
It's mainly from here: Line 232 in a95c44e
int default_stacksize, int start_profiling
|
That one might be easy enough to fix.. |
tools/webidl_binder.py
Outdated
@@ -546,7 +547,7 @@ def is_ptr_arg(i): | |||
c_names = {} | |||
|
|||
def make_call_args(i): | |||
if pre_arg: | |||
if has_pre_arg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how this is any different to bool(pre_arg)
which itself is identical to pre_arg
in an if
statement, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an assignment above that does call_args = pre_arg
, then we append to call_args
which modifies pre_arg as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could instead clone/copy pre_arg to call_args so modifying one does not modify the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, in that case I think its better to do call_args = list(pre_arg)
or call_args = copy(pre_arg)
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops call_args = pre_arg.copy()
57825e8
to
bdcd76c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Maybe update the PR title/descrption to mention that we only check for too-many and not too-few and why (because there can be valid use case for passing too few). Maybe add a comment before the assertion to that effect too?
bdcd76c
to
b757f6b
Compare
Fixes #21348