You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello 🦀 ,
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].
let first = try_conv!(conversion(ptr::read(&self[0])), error);
let second = try_conv!(conversion(ptr::read(&self[1])), error);
mem::forget(self);
match error {
None => Ok([first, second]),
Some(err) => Err((err,[first, second])),
}
}
}
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.
Thank you for checking out this issue 👍
The text was updated successfully, but these errors were encountered:
Hello 🦀 ,
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]
.basic_dsp/matrix/src/lib.rs
Lines 229 to 241 in 7375e9f
basic_dsp/matrix/src/lib.rs
Lines 243 to 258 in 7375e9f
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 👍
The text was updated successfully, but these errors were encountered: