rust-secure-code / safety-dance

Auditing crates for unsafe code which can be safely replaced
Apache License 2.0
529 stars 10 forks source link

Inspect miniz_oxide for antipatters and request Clippy lints #45

Open Shnatsel opened 4 years ago

Shnatsel commented 4 years ago

miniz_oxide has undergone a significant safety improvement recently (see #2). It had plenty of avoidable unsafe code. We should look through the changes and request Clippy lints for the antipatterns that were fixed.

The commit range for safety fixes is from https://github.com/Frommi/miniz_oxide/commit/7fc6d66be47665174de4960cc23361bdb1d42134 to https://github.com/Frommi/miniz_oxide/commit/23a6759fb473e2156b1e07279176810b6e664e59, both bounds inclusive.

For more info on requesting Clippy lints see #21.

Shnatsel commented 4 years ago

Requested lint for read_unaligned() that's prevalent in the code and can be safely replaced: https://github.com/rust-lang/rust-clippy/issues/4891

There is also a similar write_unaligned() pattern, we'll need to request a lint for it too: https://github.com/Frommi/miniz_oxide/commit/7fc6d66be47665174de4960cc23361bdb1d42134