-
Notifications
You must be signed in to change notification settings - Fork 0
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
Remove all unnecessary unsafe from bzip2.rs #48
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We shouldn't segfault and if we do anyway, we probably should abort as soon as possible rather than trying to access a bunch of possibly corrupted state to maybe give a nicer crash message and in the process possibly open up a security hole.
This will enable it to call functions that are not async-signal safe.
This will make it possible to clone a Config in the future and pass it to the ctrl-c cleanup thread.
bjorn3
force-pushed
the
less_unsafe_functions
branch
from
November 20, 2024 11:05
de2cf8a
to
23d3dd3
Compare
Codecov ReportAttention: Patch coverage is
🚨 Try these New Features:
|
Not doing so breaks error messages on Windows.
bjorn3
force-pushed
the
less_unsafe_functions
branch
from
November 20, 2024 12:22
1d5115c
to
7a917ed
Compare
This enables marking almost all functions in bzip2.rs as safe.
bjorn3
changed the title
Make a fair amount of functions in bzip2.rs safe
Remove all unnecessary unsafe from bzip2.rs
Nov 20, 2024
bjorn3
force-pushed
the
less_unsafe_functions
branch
from
November 20, 2024 15:24
a77f9aa
to
6cce442
Compare
folkertdev
reviewed
Nov 21, 2024
This reverts commit 2babbc6. Also fix the test that made me think I had to use perror.
bjorn3
force-pushed
the
less_unsafe_functions
branch
from
November 21, 2024 11:35
f92a228
to
65875b7
Compare
bjorn3
force-pushed
the
less_unsafe_functions
branch
from
November 21, 2024 14:12
65875b7
to
22ec529
Compare
folkertdev
approved these changes
Nov 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes the SIGSEGV handler, uses a helper thread for cleaning up after ctrl-c (currently untested on Windows) and removes all mutable statics and introduces a safe abstraction around
*mut FILE
.All remaining unsafe code in bzip2.rs is either to call into libbzip2 or to interface with the OS.