njs: Segfault when using .call.call construction.
> eval.call.call(function(){return String})
Segmentation fault
> URIError.apply.apply(RegExp)
Segmentation fault
> isNaN.apply.call(isNaN)
Segmentation fault
About this issue
- Original URL
 - State: closed
 - Created 5 years ago
 - Comments: 16 (16 by maintainers)
 
Commits related to this issue
- Improved njs_vm_continuation(). This closes #142 issue on Github. — committed to nginx/njs by hongzhidao 5 years ago
 
@xeioex
Here’s the final version of this patch.
@drsm thanks for your help 😃
@xeioex wait a moment. For the second patch, I think it’s still not ideal.
@hongzhidao
@xeioex
Help test and add unit tests, please. @drsm @xeioex (I’m not familiar with call/apply)
What’s the actual return value of
xxx.call(...)? For example.BTW, according to my understanding.
Function.prototype.callalways callthisas a function. So,eval.call(...)will call theevalfunction sincethisis objectevalwith propertycall.eval.call.call(foo)will callfoosincethisis bound tofoo. Right?the_object.the_function(arguments)the_function.call(the_object, arguments)the_function.apply(the_object, [arguments])@hongzhidao
Yes, they are both equal to
Function.prototype.apply.this = URIError.applythisArg = undefinedsee apply