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

Fixed used after free bug in ffi_type_array_create #1

Closed
wants to merge 1 commit into from

Conversation

xtldr
Copy link
Owner

@xtldr xtldr commented May 4, 2021

In middle::types::ffi_type_array_create the ffi_type of element is copied to new, but when element is dropped at the end of the loop, the ffi_type is deallocated while still readable from new.

If we add forget(element), the ffi_type won't be deallocated. Since Type::drop only deallocates it's ffi_type, this should be safe because the ffi_type is now owned by the resulting TypeArray.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant