diff --git a/Cargo.toml b/Cargo.toml index 7d47f879461..29a179567b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ smallvec = "1.0" wasm-timer = "0.2.4" [target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies] -libp2p-deflate = { version = "0.27.0", path = "protocols/deflate", optional = true } +libp2p-deflate = { version = "0.27.1", path = "protocols/deflate", optional = true } libp2p-dns = { version = "0.27.0", path = "transports/dns", optional = true } libp2p-mdns = { version = "0.28.0", path = "protocols/mdns", optional = true } libp2p-tcp = { version = "0.27.0", path = "transports/tcp", optional = true } diff --git a/protocols/deflate/CHANGELOG.md b/protocols/deflate/CHANGELOG.md index 6075cfd9701..26b92b2813e 100644 --- a/protocols/deflate/CHANGELOG.md +++ b/protocols/deflate/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.27.1 [2021-01-27] + +- Ensure read buffers are initialised. + [PR 1933](https://github.com/libp2p/rust-libp2p/pull/1933). + # 0.27.0 [2021-01-12] - Update dependencies. diff --git a/protocols/deflate/Cargo.toml b/protocols/deflate/Cargo.toml index 6de83b8bf89..2b01990eeea 100644 --- a/protocols/deflate/Cargo.toml +++ b/protocols/deflate/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-deflate" edition = "2018" description = "Deflate encryption protocol for libp2p" -version = "0.27.0" +version = "0.27.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/deflate/src/lib.rs b/protocols/deflate/src/lib.rs index 6ec576d8209..d93e6ed2e39 100644 --- a/protocols/deflate/src/lib.rs +++ b/protocols/deflate/src/lib.rs @@ -133,10 +133,7 @@ impl AsyncRead for DeflateOutput loop { // Read from `self.inner` into `self.read_interm` if necessary. if this.read_interm.is_empty() && !this.inner_read_eof { - unsafe { - this.read_interm.reserve(256); - this.read_interm.set_len(this.read_interm.capacity()); - } + this.read_interm.resize(this.read_interm.capacity() + 256, 0); match AsyncRead::poll_read(Pin::new(&mut this.inner), cx, &mut this.read_interm) { Poll::Ready(Ok(0)) => {