From 7976819967f93f61e0f47409d398cd108c5428ab Mon Sep 17 00:00:00 2001 From: CreativeStoic Date: Thu, 18 Jul 2024 15:48:10 -0400 Subject: [PATCH] fix unsoundness in mapped_futures cancel --- futures-util/src/stream/mapped_futures/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/futures-util/src/stream/mapped_futures/mod.rs b/futures-util/src/stream/mapped_futures/mod.rs index dfb37a756..4df4a95c9 100644 --- a/futures-util/src/stream/mapped_futures/mod.rs +++ b/futures-util/src/stream/mapped_futures/mod.rs @@ -166,7 +166,8 @@ impl MappedFutures { // 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; }