Skip to content

Implement Exception Safety #2

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

Merged
merged 2 commits into from
Dec 20, 2020
Merged

Implement Exception Safety #2

merged 2 commits into from
Dec 20, 2020

Conversation

Michael-F-Bryan
Copy link
Owner

@Michael-F-Bryan Michael-F-Bryan commented Dec 20, 2020

This is the code that would be required to implement "poisoning" in the face of panics, which we need because the FFI functions catch panics and let the *mut FileHandle be used later.

Unfortunately we need to add a poisoned flag which is checked in each vtable method instead of just FFI functions. Otherwise it is possible for a panic to occur when calling a function like ffi::file_handle_write() and the writer's internals get corrupted, then you pass the *mut FileHandle to Rust and try to call OwnedFileHandle's write() method, letting you observe a FUBAR writer.

Fixes #1.

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.

FFI unwind safety
1 participant