From f9deaa0e6b45ddb1f571be1c7f55341f924ac946 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 15 Oct 2023 19:42:59 +0200 Subject: [PATCH] Add failing test --- tokio/tests/io_take.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tokio/tests/io_take.rs b/tokio/tests/io_take.rs index 539f17f3a2d..6f22df18313 100644 --- a/tokio/tests/io_take.rs +++ b/tokio/tests/io_take.rs @@ -39,6 +39,14 @@ async fn issue_4435() { assert_eq!(&buf, &b"ABhell\0\0"[..]); } +#[tokio::test] +async fn issue_6070() { + // make sure it overflows usize on 32bit targets + let mut reader = tokio::io::repeat(0b101).take(u32::MAX as u64 + 1u64); + let copied = tokio::io::copy(&mut reader, &mut tokio::io::sink()).await.unwrap(); + assert_eq!(copied, u32::MAX as u64 + 1u64); +} + struct BadReader { leaked_buffers: LeakedBuffers, }