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 a20f0eb commit 9f2b3deCopy full SHA for 9f2b3de
src/imap_stream.rs
@@ -278,6 +278,13 @@ impl<R: Read + Write + Unpin> Stream for ImapStream<R> {
278
this.buffer.ensure_capacity(this.decode_needs)?;
279
let buf = this.buffer.free_as_mut_slice();
280
281
+ // The buffer should have at least one byte free
282
+ // before we try reading into it
283
+ // so we can treat 0 bytes read as EOF.
284
+ // This is guaranteed by `ensure_capacity()` above
285
+ // even if it is called with 0 as an argument.
286
+ debug_assert!(!buf.is_empty());
287
+
288
#[cfg(feature = "runtime-async-std")]
289
let num_bytes_read = ready!(Pin::new(&mut this.inner).poll_read(cx, buf))?;
290
0 commit comments