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

tree-sitter-c2rust causes stack overflow (infinite recursion) #5

Open
mainrs opened this issue Apr 24, 2024 · 1 comment
Open

tree-sitter-c2rust causes stack overflow (infinite recursion) #5

mainrs opened this issue Apr 24, 2024 · 1 comment

Comments

@mainrs
Copy link

mainrs commented Apr 24, 2024

Sorry to hijack this issue tracker. But I didn't know how to contact you.

I've been trying to use tree-sitter-c2rust to create a typst plugin. They support WASM plugins. The issue I encounter is that, as soon as I call into the library, my process crashes due to an infinite recursion. For example creating a parser using Parser::new().

The runtime in question is wasmi. They have a pretty big stack size of 2MB by default. And I still hit the stack overflow. That's why I think it is caused by infinite recursion.

Did you happen to have a similar issue when working on this project?

@liamrosenfeld
Copy link
Contributor

liamrosenfeld commented Apr 24, 2024

I haven't encountered that issue with creating a parser before. By chance, are you encapsulating the tree sitter parser in your own Parser struct? If you're doing that, calling tree_sitter::Parser::new() inside of your_crate::Parser::new() could actually be calling your_crate::Parser::new() again and cause infinite recursion.

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

2 participants