We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 773b7c5 commit abfbd51Copy full SHA for abfbd51
src/imap_stream.rs
@@ -270,6 +270,13 @@ impl<R: Read + Write + Unpin> Stream for ImapStream<R> {
270
this.buffer.ensure_capacity(this.decode_needs)?;
271
let buf = this.buffer.free_as_mut_slice();
272
273
+ // The buffer should have at least one byte free
274
+ // before we try reading into it
275
+ // so we can treat 0 bytes read as EOF.
276
+ // This is guaranteed by `ensure_capacity()` above
277
+ // even if it is called with 0 as an argument.
278
+ debug_assert!(buf.len() > 0);
279
+
280
#[cfg(feature = "runtime-async-std")]
281
let num_bytes_read = ready!(Pin::new(&mut this.inner).poll_read(cx, buf))?;
282
0 commit comments