Hello :crab: ,
we (Rust group @sslab-gatech) found a memory-safety/soundness issue in this crate while scanning Rust code on crates.io for potential vulnerabilities.
Issue Description
The issue is relevant to implementation of TransformContent<S, D> trait for [S; 2], [S; 3], and [S; 4].
If a panic happens within conversion,
item(S) within self can be dropped twice since the ownership of the item within self is duplicated with ptr::read().
Suggested Fix
By keeping self within ManuallyDrop<_> instead of using mem::forget(),
it is possible to guard against such double drop bugs.
I will immediately submit a PR containing the suggested fix.
Hello :crab: , we (Rust group @sslab-gatech) found a memory-safety/soundness issue in this crate while scanning Rust code on crates.io for potential vulnerabilities.
Issue Description
The issue is relevant to implementation of
TransformContent<S, D>
trait for[S; 2]
,[S; 3]
, and[S; 4]
.https://github.com/liebharc/basic_dsp/blob/7375e9f02769c95bf1bdb58cb2130afcccdf3f50/matrix/src/lib.rs#L229-L241
https://github.com/liebharc/basic_dsp/blob/7375e9f02769c95bf1bdb58cb2130afcccdf3f50/matrix/src/lib.rs#L243-L258
If a panic happens within
conversion
, item(S
) withinself
can be dropped twice since the ownership of the item withinself
is duplicated withptr::read()
.Suggested Fix
By keeping
self
withinManuallyDrop<_>
instead of usingmem::forget()
, it is possible to guard against such double drop bugs. I will immediately submit a PR containing the suggested fix.Thank you for checking out this issue :+1: