[quickjs-devel] Re: The method "decodeURIComponent" does not meet the specification

  • From: Fabrice Bellard <fabrice@xxxxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Fri, 27 Sep 2019 14:37:52 +0200

Hi,

Thank you for the bug report. It will be fixed in the next release.

Best regards,

Fabrice.

On 09/26/2019 11:18 AM, Houyou Yao wrote:

Hello,
    Expected URIError exception is not thrown when running statement
"decodeURIComponent("%ED%AF%BF");"

# Version: quickjs-2019-09-18

# Testcase:
var NISLFuzzingFunc = function() {
    var tmp = decodeURIComponent("%ED%AF%BF");
    print(tmp.length);
};
NISLFuzzingFunc();

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

# Output:
1

# Expected output:
Throw URIError on Line 2

# Description:
     I have manually calculated the statement
"decodeURIComponent("%ED%AF%BF")" according to the definition of
"decodeURIComponent" in the ES standard. If I correctly understand the
ES standard, QuickJS should throw a URIError exception instead of
printing "1". In addition, other engines throw URIError exception as
expected, such as v8, spiderMonkey, javascriptCore, chakra. So, I
suspect this is a bug of QuickJS.
The step that QuickJS should throw URIError exception is as follows??
"3. If n equals 1 or n is greater than 4, throw a URIError exception."
(n==1)

The references of ECMAScript are as follows:
https://tc39.es/ecma262/#sec-decodeuricomponent-encodeduricomponent
https://tc39.es/ecma262/#sec-decode

Cheers,
Houyou Yao





Other related posts: