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

Doesn't fail on invalid unicode escape sequences in export / import #1867

Open
ghost opened this Issue Oct 24, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@ghost

ghost commented Oct 24, 2017

This is for both import and export. And here is one TC-39 reference showing the issue.

Steps to reproduce

esprima.parse('export {a \\u0061s b} from "./foo.js";')

Expected output

Should throw

Actual output

Outputs and AST

Relevant references

ShiftJS and Acorn also outputs an invalid AST. However V8 throws correctly

@bakkot

This comment has been minimized.

Show comment
Hide comment
@bakkot

bakkot Oct 24, 2017

It (and basically everyone save Firefox) similarly incorrectly accepts ({ g\u{65}t x(){} }), and probably escape sequences in other contextual keywords too.

Edit: a slightly expanded list of invalid programs accepted by esprima:

({ g\u0065t x(){} });
export {a \u0061s b} from "";
export {} fr\u006fm "";
for (a o\u0066 b);
class a {
  st\u0061tic m(){}
}
\u0061sync function f(){}
async function f(){
  \u0061wait 0;
}

bakkot commented Oct 24, 2017

It (and basically everyone save Firefox) similarly incorrectly accepts ({ g\u{65}t x(){} }), and probably escape sequences in other contextual keywords too.

Edit: a slightly expanded list of invalid programs accepted by esprima:

({ g\u0065t x(){} });
export {a \u0061s b} from "";
export {} fr\u006fm "";
for (a o\u0066 b);
class a {
  st\u0061tic m(){}
}
\u0061sync function f(){}
async function f(){
  \u0061wait 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment