-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Cursor position silently wraps around during write to Vec<u8> #36884
Comments
This line here seems to be the culprit: https://github.com/rust-lang/rust/blob/master/src/libstd/io/cursor.rs#L251 |
Also, I don't know why zero-filling is necessary, as they'll just be immediately overwritten. If it's an issue of panic safety, then there's probably a better way to do it. |
The cursor implementation for vector is similar to file operations. If cursor Second, the data is actually written starting from cursor position, extending In general the Cursor interface seems potentially error prone for in-memory |
…xcrichton Check for overflow in Cursor<Vec<u8>>::write. Ensure that cursor position fits into usize, before proceeding with write. Fixes issue rust-lang#36884.
This is no longer an issue, since we check for the potential overflow and return an error instead: Line 258 in 10d7cb4
|
On 32-bit platform it currently prints: "[1]". It should fail or panic instead.
The text was updated successfully, but these errors were encountered: