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

Stack overflow with hundreads of { inside slint file #6494

Open
qarmin opened this issue Oct 8, 2024 · 2 comments
Open

Stack overflow with hundreads of { inside slint file #6494

qarmin opened this issue Oct 8, 2024 · 2 comments
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working priority:low Lowest priority. The issue is kept open for tracking purpose, but noone is actively working on this

Comments

@qarmin
Copy link

qarmin commented Oct 8, 2024

Slint nightly lsp in vscode - 2024-10-08, 18:37:51

a.slint.zip

crashes with info

thread 'LanguageServer' has overflowed its stack
fatal runtime error: stack overflow

I cannot check code where exactly this panics, because this happens only inside Visual Studio Code

@qarmin
Copy link
Author

qarmin commented Oct 8, 2024

Is there any command that I could to run from cli to reproduce issue?
I could minimize output if this would be possible

@ogoffart
Copy link
Member

ogoffart commented Oct 9, 2024

you can try to run slint-compiler.

Indeed, the compiler is a recursive descent parser and there is no protection for stack overflow when going too deep (thousands of opening braces).

Solution could include:

  • Do a pass before the actual parsing counting the number of opening braces and printing an error if this is too big (say a thousand)
  • Within the parser, keep a recursion count state, and error if it is too big
  • Somehow detect stack overflow through other mean. (how?) and have an error thrown out when we use too much stack instead of a crash.

@ogoffart ogoffart added bug Something isn't working a:compiler Slint compiler internal (not the codegen, not the parser) priority:low Lowest priority. The issue is kept open for tracking purpose, but noone is actively working on this labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working priority:low Lowest priority. The issue is kept open for tracking purpose, but noone is actively working on this
Projects
None yet
Development

No branches or pull requests

2 participants