Skip to content

Commit

Permalink
fix unsoundness in mapped_futures cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
StoicDeveloper committed Jul 18, 2024
1 parent 08acad3 commit 7976819
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion futures-util/src/stream/mapped_futures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ impl<K: Hash + Eq, Fut> MappedFutures<K, Fut> {
// if let Some(task) = self.hash_set.get(key) {
if let Some(task) = self.set().take(key) {
unsafe {
if let Some(_) = (*task.future.get()).take() {
if (*task.future.get()).is_some() {
task.future.get().write(None);
self.inner.unlink(Arc::as_ptr(&task.inner));
return true;
}
Expand Down

0 comments on commit 7976819

Please sign in to comment.