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

Fix use after free of native function return value. #30

Merged
merged 1 commit into from
May 31, 2023

Conversation

MeirShpilraien
Copy link
Contributor

When we call a native function we should avoid creating a new isolate scope because when the isolate scope will be freed, all the local handlers will be marked for GC and potenatially freed as well. This includes the return value.

To avoid that, we create a dummy isolate scope. From user POV, the dummy isolate scope can be used like a regular isolate scope, But it will not cause local handler to be freed when it is released.

When we call a native function we should avoid creating a new
isolate scope because when the isolate scope will be freed, all
the local handlers will be marked for GC and potenatially freed
as well. This includes the return value.

To avoid that, we create a dummy isolate scope. From user POV,
the dummy isolate scope can be used like a regular isolate scope,
But it will not cause local handler to be freed when it is released.
@MeirShpilraien MeirShpilraien requested a review from iddm May 31, 2023 14:40
@iddm
Copy link
Collaborator

iddm commented May 31, 2023

We should check if it is possible to rewrite this "dummy" isolate to a strong type with lifetimes and make sure we don't rely on some knowledge, such as "we know that ...".

@iddm iddm merged commit 7797d07 into master May 31, 2023
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.

2 participants