Advisory

GHSA-6m57-8r3p-pqx6

Details, part 2 of 2. The advisory

Details

Cleaner: restructure Sender<T> to hold producer and consumer in a private enum Endpoint<T> so no transmute is required, or use the bounded_spsc_queue::Producer<T>::reclaim() escape hatch if available.

Suggested patch (secondary defect)
if let Err(std::sync::mpsc::SendError(_)) = self.send_new.send(new_consumer) {
// Receiver has been dropped: take the message back as the public
// SendError, the same way the connected==false early-return does.
return Err(SendError(t));
}
Regression test (release-mode, race shape)
#[test]
fn race_disconnect_does_not_corrupt_sender_or_abort() {
for _ in 0..200 {
let (tx, rx) = unbounded_spsc::channel::<Box<u64>>();
let h = std::thread::spawn(move || {
for _ in 0..10_000 {
let _ = tx.send(Box::new(0xDEAD_BEEF));
}
});
drop(rx);
h.join().unwrap();
}
}
Reverse dependencies
Two crates on crates.io depend on unbounded-spsc, both owned by you: apis (process-calculus framework) and gooey-rs (tile-UI library, unbounded-spsc gated behind opengl/fmod features). The OpenGL/FMOD callback-mailbox use is a natural rx-drop-during-tx-send scenario at scene-graph teardown. A single coordinated bump cycle is feasible.

Researcher
Berkant Koc [email protected]
PGP: 0C588DFD76204987284213EA0AC529C41F8AA5D6

Sources & licences