Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

await an expression with surrogate characters raises a SyntaxError #39929

Closed
Mesteery opened this issue Aug 29, 2021 · 4 comments
Closed

await an expression with surrogate characters raises a SyntaxError #39929

Mesteery opened this issue Aug 29, 2021 · 4 comments
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.

Comments

@Mesteery
Copy link
Member

Mesteery commented Aug 29, 2021

Version

16.8.0

Platform

No response

Subsystem

repl

What steps will reproduce the bug?

$ node
Welcome to Node.js v16.8.0.
Type ".help" for more information.
> await '馃榾馃榾馃榾' // or
> await '馃榾馃榾馃榾'; // or
> await '馃榾馃榾馃榾';;

How often does it reproduce? Is there a required condition?

All the time, as long as there is a top level await with one or more surrogate chars with a semicolon, or at least 3 surrogate chars.

What is the expected behavior?

> await '馃榾馃榾馃榾'
'馃榾馃榾馃榾'

What do you see instead?

> await '馃榾馃榾馃榾'
 }))()
 ^

Uncaught SyntaxError: Unexpected token '}'

> await '馃榾馃榾馃榾';
(async () => { return (await '馃榾馃榾馃榾';
                                     ^

Uncaught SyntaxError: Unexpected token ';'

> await '馃榾馃榾馃榾';;
undefined

Additional information

This is obviously reproducible with a more complex expression (for example await new buffer.Blob(['aaa', Buffer.from('猫猫ee馃榿馃榿馃榿aaa')]).text().

@Mesteery Mesteery added the repl Issues and PRs related to the REPL subsystem. label Aug 29, 2021
@targos targos added the confirmed-bug Issues with confirmed bugs. label Aug 29, 2021
@targos
Copy link
Member

targos commented Aug 29, 2021

@nodejs/repl

@Mesteery
Copy link
Member Author

By the way there is another unrelated bug: await <any>;; != <any>;;. I don't know if this is intentional. Should I do another issue?

> await 1;;
undefined
> 1;;
1

@Ayase-252
Copy link
Member

Ayase-252 commented Aug 29, 2021

@Mesteery I think it is a seperate issue. it would be worth to open a new issue. 馃

Output from chrome dev tool
Screen Shot 2021-08-29 at 22 15 42

@devsnek
Copy link
Member

devsnek commented Aug 29, 2021

the infinite stream of bugs for fake tla is even better than I thought it would be

@Mesteery Mesteery changed the title await an expression with at least 3 surrogate characters raises a SyntaxError await an expression with surrogate characters raises a SyntaxError Aug 29, 2021
Mesteery added a commit to Mesteery/node that referenced this issue Aug 29, 2021
@targos targos closed this as completed in addb30f Sep 8, 2021
BethGriggs pushed a commit that referenced this issue Sep 21, 2021
Fixes: #39929

PR-URL: #39931
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants