From ad8fb411030d4ce375261aec41ef7235edae5309 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Fri, 15 Jan 2021 00:09:07 +0100 Subject: [PATCH 1/2] io: fix unsoundness in read_to_end (#3428) --- .github/workflows/ci.yml | 4 ++-- tokio/src/io/util/read_to_end.rs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd4972ed0..c8640a9af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,8 @@ on: push: - branches: ["master"] + branches: ["master", "tokio-*.x"] pull_request: - branches: ["master"] + branches: ["master", "tokio-*.x"] name: CI diff --git a/tokio/src/io/util/read_to_end.rs b/tokio/src/io/util/read_to_end.rs index f40d148e2..1aee6810e 100644 --- a/tokio/src/io/util/read_to_end.rs +++ b/tokio/src/io/util/read_to_end.rs @@ -72,14 +72,13 @@ fn poll_read_to_end( let mut unused_capacity = ReadBuf::uninit(get_unused_capacity(buf)); + let ptr = unused_capacity.filled().as_ptr(); ready!(read.poll_read(cx, &mut unused_capacity))?; + assert_eq!(ptr, unused_capacity.filled().as_ptr()); let n = unused_capacity.filled().len(); let new_len = buf.len() + n; - // This should no longer even be possible in safe Rust. An implementor - // would need to have unsafely *replaced* the buffer inside `ReadBuf`, - // which... yolo? assert!(new_len <= buf.capacity()); unsafe { buf.set_len(new_len); From 5d35c907f693e25ba20c3cfb47e0cb1957679019 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Thu, 14 Jan 2021 16:37:40 -0800 Subject: [PATCH 2/2] chore: release tokio v1.0.2 (#3429) --- tokio/CHANGELOG.md | 5 +++++ tokio/Cargo.toml | 4 ++-- tokio/src/lib.rs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tokio/CHANGELOG.md b/tokio/CHANGELOG.md index 3b46d92e1..a36212d54 100644 --- a/tokio/CHANGELOG.md +++ b/tokio/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.0.2 (January 14, 2020) + +### Fixed +- io: soundness in `read_to_end` (#3428). + # 1.0.1 (December 25, 2020) This release fixes a soundness hole caused by the combination of `RwLockWriteGuard::map` diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 0849a369a..f950a286d 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -8,12 +8,12 @@ name = "tokio" # - README.md # - Update CHANGELOG.md. # - Create "v1.0.x" git tag. -version = "1.0.1" +version = "1.0.2" edition = "2018" authors = ["Tokio Contributors "] license = "MIT" readme = "README.md" -documentation = "https://docs.rs/tokio/1.0.1/tokio/" +documentation = "https://docs.rs/tokio/1.0.2/tokio/" repository = "https://github.com/tokio-rs/tokio" homepage = "https://tokio.rs" description = """ diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 2efcaf759..7b098c761 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://docs.rs/tokio/1.0.1")] +#![doc(html_root_url = "https://docs.rs/tokio/1.0.2")] #![allow( clippy::cognitive_complexity, clippy::large_enum_variant,