[quickjs-devel] A possible bug about escape

  • From: "Houyou Yao" <yaohouyou@xxxxxx>
  • To: "QuickJS" <quickjs-devel@xxxxxxxxxxxxx>
  • Date: Wed, 11 Dec 2019 17:15:21 +0800

# Version: quickjs-2019-10-27


# Testcase:
var NISLFuzzingFunc = function() {
&nbsp; &nbsp; var x = escape(String(null));
&nbsp; &nbsp; print(x);
&nbsp; &nbsp; var y = escape(null);
&nbsp; &nbsp; print(y);
};
NISLFuzzingFunc();



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


# Output:
null
TypeError: null or undefined are forbidden
&nbsp; &nbsp; at NISLFuzzingFunc (testcase.js:4)
&nbsp; &nbsp; at <eval&gt; (testcase.js:8)

# Expected output: 

null
null



# Description:
According to ES2020, when calling function 'escape (string)', the argument 
should be converted&nbsp;to string at first while QuickJS does not do it.
The reference of ES2020 is as follows:
https://tc39.es/ecma262/#sec-escape-string

Other related posts: