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

Segmentation fault parsing let % #10

Closed
the-mikedavis opened this issue Jul 5, 2022 · 3 comments · Fixed by #11
Closed

Segmentation fault parsing let % #10

the-mikedavis opened this issue Jul 5, 2022 · 3 comments · Fixed by #11
Assignees

Comments

@the-mikedavis
Copy link

Hello! 👋

It looks like there's an edge case that causes the parser to segfault:

$ echo "let %" > test.ncl
$ tree-sitter parse test.ncl
Segmentation fault (core dumped)

I'm not sure where it's coming from - mostly I've seen segfaults come from bugs in external scanners but I've also seen one come from the parser without an external scanner (victorhqc/tree-sitter-prisma#39).

Originally reported in helix-editor/helix#2979

@ErinvanderVeen ErinvanderVeen self-assigned this Jul 6, 2022
@ErinvanderVeen
Copy link
Collaborator

Thank you for reporting this! I'll take a look as soon as I can find the time.

@yannham
Copy link
Contributor

yannham commented Jul 6, 2022

I haven't fiddled with tree-sitter myself, but don't we just feed it with a grammar description in JSON ? That's quite sad if an incorrect definition leads to a segfault 😕

@yannham
Copy link
Contributor

yannham commented Jul 6, 2022

Ah, your PR seems to answer the question: no, it seems there is a hand-written C scanner which was the culprit.

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

Successfully merging a pull request may close this issue.

3 participants