yoshuawuyts / futures-concurrency

Structured concurrency operations for async Rust
https://docs.rs/futures-concurrency
Apache License 2.0
382 stars 29 forks source link

Fix #155 #157

Closed yoshuawuyts closed 10 months ago

yoshuawuyts commented 10 months ago

Fixes #155. The bug was that we were unconditionally marking a field as "done" in our TryJoin implementations, and then branched on the output value, with only one branch writing a value.

Our drop impl assumed that if a value was marked as "done" that the field was populated. But that wasn't true if TryJoin returned with an error, meaning it would attempt to drop uninitialized memory.

This affects all three TryJoin implementations since they're subtle adaptations of one another. I believe this bug was introduced as part of the work towards https://github.com/yoshuawuyts/futures-concurrency/issues/137. We should release a patch release as soon as we've merged this PR.