-
Notifications
You must be signed in to change notification settings - Fork 514
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
Segmentation fault in duk_js_putvar_activation #1370
Comments
@renatahodovan Thanks, confirmed! I'm a bit busy with other stuff right now, but I'll take a look as soon as I can. |
I was able to reduce the test a bit, this still triggers the issue: (function print() {
--print === print();
})(); Renaming the function from print to something else removes the issue (even if a "print" binding exists in the global object) so the issue is possibly related to the function name binding which has its own scope object. |
Function name or shadowing a global variable has no impact, this still triggers the issue: (function foo() {
foo-- === foo();
})(); |
I'm curious if it's just the |
Without the comparison there's no (outward) issue, and neither with The comparison itself is not necessary, this still causes the issue: (function foo() {
foo--; foo();
})(); |
To be clear this isn't an uncaught error nor is an assert triggered. |
Ok, I think I found the culprit, fix is in #1371:
In this case:
This is why the function must involve recursion (foo()) for the bug to manifest. |
ToNumber() coercion involves an Ecmascript-side call? That's interesting. I figured that would only happen if there was, e.g., a |
Yes, ToNumber() on an object first coerces the object to primitive using ToPrimitive() with hint "number" -- IOW it first tries |
@fatcerberus So to be clear, there's no function call unless the ToNumber() target is an object -- here the target value is a function so |
Duk version:
OS:
Test case:
Backtrace:
Found by Fuzzinator
The text was updated successfully, but these errors were encountered: