-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ufuzz failure #4269
Comments
@kzc behold the beauty of ECMAScript! 🤣 $ node -v
v14.13.1 $ echo console.log({ set 1(v){}, [2]:0, 1:3 }) | node
{ '1': 3, '2': 0 }
$ echo console.log({ set 1(v){}, 2:0, 1:3 }) | node
{ '1': [Setter], '2': 0 } A computed property will reorder your other properties even though the computed value is not colliding with any other names. But only if those other names are numbers... $ echo console.log({ set p(v){}, [2]:0, p:3 }) | node
{ '2': 0, p: 3 }
$ echo console.log({ set p(v){}, 2:0, p:3 }) | node
{ '2': 0, p: 3 } ... so how about if I quote those "numbers" so they are definitely strings? $ echo console.log({ set "1"(v){}, [2]:0, "1":3 }) | node
{ '1': 3, '2': 0 }
$ echo console.log({ set "1"(v){}, 2:0, "1":3 }) | node
{ '1': [Setter], '2': 0 } $ echo console.log({ set "1"(v){}, ["2"]:0, "1":3 }) | node
{ '1': 3, '2': 0 }
$ echo console.log({ set "1"(v){}, "2":0, "1":3 }) | node
{ '1': [Setter], '2': 0 } ... nup, coz reasons. |
That's pretty obscure. Only a fuzzer would find such a thing. If it makes you feel any better, both babel and buble get it wrong too:
Sometimes I find if you read the ES spec there is some rhyme or reason for the ordering. Then other times it's just an arbitrary decision based on the initial implementation of the feature. |
You'd hope there'll at least be consistency... $ node -v
v0.10.48
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': 2, '07': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': 2, '08': [Setter] } $ node -v
v0.12.18
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
[stdin]:1
console.log({ set 07(v) {}, 07: 2, });
^^
SyntaxError: Object literal may not have data and accessor property with the same name
at Object.exports.runInThisContext (vm.js:73:16)
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
[stdin]:1
console.log({ set 08(v) {}, 08: 2, });
^^
SyntaxError: Object literal may not have data and accessor property with the same name
at Object.exports.runInThisContext (vm.js:73:16) $ node -v
v4.9.1
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': [Setter] } $ node -v
v6.17.1
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': [Setter] } $ node -v
v8.17.0
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': [Setter] } $ node -v
v10.22.1
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': [Setter] } $ node -v
v12.19.0
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': 2, '08': [Setter] } $ node -v
v14.13.1
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': 2, '08': [Setter] } |
Interesting. Either this is behavior is not defined by the spec, or it's an engine issue. What do other browser engines produce? |
Syntax Error (duplicated setter/property name) on Internet Explorer 11
Syntax Error (duplicated setter/property name) on Opera 12 $ nvs use chakracore
v10.13.0
$ echo console.log({ set 07(v) {}, 07: 2, }); | node
{ '7': [Setter] }
$ echo console.log({ set 08(v) {}, 08: 2, }); | node
{ '8': [Setter] } |
So it appears to be undefined behavior in the spec. Not helpful for fuzzing. |
Let's see if they would take care of #4941 as well. |
The text was updated successfully, but these errors were encountered: