[quickjs-devel] A possible issue about the scope of variable in QuickJS

  • From: "??????" <yaohouyou@xxxxxx>
  • To: "QuickJS" <quickjs-devel@xxxxxxxxxxxxx>
  • Date: Fri, 6 Sep 2019 20:35:26 +0800

Dear Sir or Madam:
  I have a doubt about QuickJS, the detailed description is as follows:





## version: quickjs-2019-08-18


## Testcase:
var NISLFuzzingFunc = function(eval) {
    print(eval("print(false);"));
};
var NISLParameter1 = function() {
    print("run to NISLParameter1");
    return true;
};
NISLFuzzingFunc(NISLParameter1);


## Command:
./ quickjs-2019-08-18/qjs testcase.js


## Output:
false
undefined


## Expected output:
run to NISLParameter1
true


## Description:
    In the testcase above, "eval"??Line 2?? should be the formal parameter 
"eval", but QuickJS treats it as a global object "eval". According to the scope 
of variable, I think this may be a bug in QuickJS. 
    Do you think so? Looking forward to your reply.



your faithfully
houyou yao

Other related posts: