Does TokioIo::poll_read
violate the safety requirement of ReadBufCursor::as_mut
?
#3819
Labels
C-bug
Category: bug. Something is wrong. This is bad!
I'm unable to create an issue or start a discussion in
hyper-util
, so I'm starting one here. I have essentially zero experience withunsafe
code except in the simplest cases, so I apologize if this question is rudimentary.Anyway, the safety comment for
ReadBufCursor::as_mut
states "The caller must not uninitialize any bytes that may have been initialized before.".TokioIo
implementsRead::poll_read
in a way that appears to violate this requirement. Specifically, whenAsyncRead::poll_read
errs it immediately returns the error without advancing the buffer. Doesn't this mean that a call toRead::poll_read
after an error will cause previously initialized memory to be unitialized when the previous call initialized some of the bytes before erring?The text was updated successfully, but these errors were encountered: