-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reader reads free memory #5
Comments
We are using The internal architecture is such that, until the reader reads the chunk data, the writer's write method will block (asynchronously off-course). let (mut writer, mut reader) = pipe();
let mut write_buf = vec![0u8; 1024];
let _ = futures::poll!(writer.write_all(&mut write_buf)); //---> This statement should block until the reader reads the data.
drop(write_buf); |
I will check this once. |
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the cost of an additional copy of the data send through the pipe and having a buffer in the state. Moreover all unsafe code is removed and the need for a custom `Drop` implementation which makes the code overall easier. We also add tests.
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the cost of an additional copy of the data send through the pipe and having a buffer in the state. Moreover all unsafe code is removed and the need for a custom `Drop` implementation which makes the code overall easier. We also add tests.
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the cost of an additional copy of the data send through the pipe and having a buffer in the state. Moreover all unsafe code is removed and the need for a custom `Drop` implementation which makes the code overall easier. We also add tests.
The latest version of the AsyncRead trait now uses ReadBuf to handle potentially uninitialized memory. Here's the issue with the proposal and background. If we can prioritize #8, we can make swifter headway on this issue. 🙂 |
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the cost of an additional copy of the data send through the pipe and having a buffer in the state. All unsafe code is removed and the need for a custom `Drop` implementation which makes the code overall easier. We also provide an implementation for traits from `futures` which is behind a feature flag. We also add tests.
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the cost of an additional copy of the data send through the pipe and having a buffer in the state. All unsafe code is removed and the need for a custom `Drop` implementation which makes the code overall easier. We also provide an implementation for traits from `futures` which is behind a feature flag. We also add tests.
It is possible for the reader to read freed memory.
The following example will panic at the assertion. The reader will read from the memory location previously occupied by
write_buf
which is now occupied byread_buf
.To address this I’d suggest to copy the the write buffer into
state.data
instead of using*const u8
.The text was updated successfully, but these errors were encountered: