Skip to content

fix: prevent Nan::Utf8String destructor call due to out of scope - #81

Merged
maxbrunsfeld merged 3 commits into
tree-sitter:masterfrom
ahlinc:fix/segmentation-fault/72
Mar 8, 2021
Merged

maxbrunsfeld merged 3 commits into
tree-sitter:masterfrom
ahlinc:fix/segmentation-fault/72

Conversation

@ahlinc

@ahlinc ahlinc commented Mar 7, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #72
This PR resolves the issue due to automatic Nan::Utf8String destructor call due to outing of scope on line 108 what leads to:

source == "\0"
source_len > 0

so ts_query_new function would try to read a lot of bytes from a string contained in the destructed Nan::Utf8String object whose memory is most likely to be freed already in case of a long input string.

@ahlinc
ahlinc force-pushed the fix/segmentation-fault/72 branch 2 times, most recently from b354f09 to 24bd48b Compare March 8, 2021 00:43
@ahlinc
ahlinc force-pushed the fix/segmentation-fault/72 branch from 24bd48b to 596b945 Compare March 8, 2021 21:05
@maxbrunsfeld
maxbrunsfeld merged commit 964c797 into tree-sitter:master Mar 8, 2021
@maxbrunsfeld

Copy link
Copy Markdown
Contributor

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.

terminated by signal SIGSEGV (Address boundary error)

2 participants