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

Realloc open blocks when deserializing #115

Merged
merged 2 commits into from
Nov 5, 2023

Conversation

ibash
Copy link
Contributor

@ibash ibash commented Sep 16, 2023

Previously deserializing assumed that open_blocks had enough capacity to deserialize all blocks. It appears that this is not always the case and that open blocks can overflow.

This commit will realloc s->open_blocks if the current capacity is not big enough.

Fixes #114
Fixes neovim/neovim#25164

Note that I tested this on my machine with the steps/file that reproduces a crash in neovim/neovim#25164 and it worked reliably.

Previously deserializing assumed that open_blocks had enough capacity to
deserialize all blocks. It appears that this is not always the case and
that open blocks can overflow.

This commit will realloc s->open_blocks if the current capacity is not
big enough.

Fixes tree-sitter-grammars#114
Fixes neovim/neovim#25164
Tree sitter generated parsers are different if you build on arm vs x86.
This was causing the ci test to fail since I'm using an m1 mac, but the
ci tests are using x86.

Rebuilding in docker to fix that.
@ibash
Copy link
Contributor Author

ibash commented Sep 17, 2023

cc @MDeiml (not sure how to assign for review)

@amaanq
Copy link
Member

amaanq commented Sep 17, 2023

looks good, surprised no one caught it before 😁

@MDeiml MDeiml merged commit b6b507c into tree-sitter-grammars:split_parser Nov 5, 2023
2 checks passed
@MDeiml
Copy link
Collaborator

MDeiml commented Nov 5, 2023

Thanks!

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 this pull request may close these issues.

Crash from xmalloc Neovim crashes when editing multilevel list
4 participants