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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential infinite loop #124

Open
fnuecke opened this issue Dec 4, 2024 · 0 comments
Open

Potential infinite loop #124

fnuecke opened this issue Dec 4, 2024 · 0 comments

Comments

@fnuecke
Copy link

fnuecke commented Dec 4, 2024

Hi! First of all, thanks for this tool :)

I've noticed that with some inputs/configurations, the tab would just hang indefinitely. After shortly debugging, I've tracked it down to this line:

In my case, when the method tokenString is called with " and then a string is passed that only contains a single " the input reaches end of stream.

Reaching end of stream being the critical part here. I'm assuming the !== null check is there to catch that. However, for me on both Vivaldi and Firefox (running on Linux), I'm observing that next() returns undefined on end of stream instead of null, so the loop never breaks.

This can be easily reproduced by opening the shader playground website and running the following in the developer console:

new CodeMirror.StringStream('').next()  // outputs 'undefined' to the console for me

If this can be reproduced, it should be a simple enough change from !== null to !== undefined. A paranoid fix would be to check for both. If desired, I can make a PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant