Document Internal Safety and Remove Most Unsafety #127
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 gets rid of almost all difficult to prove safety variants in the util and write-integer crates and with careful redesign, almost all of the unsafe use in both has been removed. Only
algorithm
still has some but due to the isolated nature of it and the easy-to-prove conditions of safety as long as the direct caller ensures the buffer size is sufficient, there is little risk of a large security vulnerability.Documentation on the safety considerations has also been made prominent. This also makes it easier for security audits to find potential causes of vulnerabilities. The documentation will improve further.
This also fixes UB in our radix serializer.
Closes #126
Addressed #100