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

Crash in parser involving an assign call inside multi-assign #11442

Closed
oprypin opened this issue Nov 12, 2021 · 0 comments · Fixed by #12919
Closed

Crash in parser involving an assign call inside multi-assign #11442

oprypin opened this issue Nov 12, 2021 · 0 comments · Fixed by #12919
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser

Comments

@oprypin
Copy link
Member

oprypin commented Nov 12, 2021

Code to cause a compiler crash:

a, a.<=
Index out of bounds (IndexError)
  from src/array.cr:1253:11 in 'pop'
  from src/compiler/crystal/syntax/parser.cr:214:19 in 'parse_multi_assign'
  from src/compiler/crystal/syntax/parser.cr:112:13 in 'parse_expressions_internal'
  from src/compiler/crystal/syntax/parser.cr:104:29 in 'parse_expressions'
  from src/compiler/crystal/syntax/parser.cr:83:21 in 'parse'
  from src/compiler/crystal/compiler.cr:245:7 in 'parse'
  from src/compiler/crystal/compiler.cr:228:11 in 'parse'
  from src/compiler/crystal/compiler.cr:167:14 in 'compile'
  from src/compiler/crystal/command/eval.cr:29:14 in 'eval'
  from src/compiler/crystal/command.cr:97:7 in 'run'
  from src/compiler/crystal/command.cr:49:5 in 'run'
  from src/compiler/crystal/command.cr:48:3 in 'run'
  from src/compiler/crystal.cr:11:1 in '__crystal_main'
  from src/crystal/main.cr:110:5 in 'main_user_code'
  from src/crystal/main.cr:96:7 in 'main'
  from src/crystal/main.cr:119:3 in 'main'
  from /usr/lib/libc.so.6 in '__libc_start_main'
  from /home/blaxpirit/repos/crystal/.build/crystal in '_start'
  from ???
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

This error is not new.

And if you try to add more to this weird source snippet, it instead shows some unhelpful error messages; seems to be in a really weird state.

I couldn't find the cause.

Found with fuzzing :) - one of the few remaining issues in that area

@oprypin oprypin added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants