-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
fix #120603 by adding a check in default_read_buf #120607
Conversation
r? @m-ou-se (rustbot has picked a reviewer for you, use r? to override) |
While fixing this, I noticed that Take has a similar panic, which reassures me that panicking here is the correct (or at least consistent) thing to do: rust/library/std/src/io/mod.rs Line 2873 in bf3c6c5
|
f923e7a
to
4c694db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@bors r+ |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
fix rust-lang#120603 by adding a check in default_read_buf Fixes rust-lang#120603 by checking the returned read n is in-bounds of the cursor. Interestingly, I noticed that `BorrowedBuf` side-steps this issue by using checked accesses. Maybe this can be switched to unchecked to mirror what BufReader does https://github.com/rust-lang/rust/blob/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/core/src/io/borrowed_buf.rs#L95
fix rust-lang#120603 by adding a check in default_read_buf Fixes rust-lang#120603 by checking the returned read n is in-bounds of the cursor. Interestingly, I noticed that `BorrowedBuf` side-steps this issue by using checked accesses. Maybe this can be switched to unchecked to mirror what BufReader does https://github.com/rust-lang/rust/blob/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/core/src/io/borrowed_buf.rs#L95
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion) - rust-lang#120518 (riscv only supports split_debuginfo=off for now) - rust-lang#120521 (Make `NonZero` constructors generic.) - rust-lang#120527 (Switch OwnedStore handle count to AtomicU32) - rust-lang#120550 (Continue to borrowck even if there were previous errors) - rust-lang#120587 (miri: normalize struct tail in ABI compat check) - rust-lang#120590 (Remove unused args from functions) - rust-lang#120607 (fix rust-lang#120603 by adding a check in default_read_buf) Failed merges: - rust-lang#120575 (Simplify codegen diagnostic handling) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#119481 (Clarify ambiguity in select_nth_unstable docs) - rust-lang#119600 (Remove outdated references to librustc_middle) - rust-lang#120458 (Document `&CStr` to `CString` conversion) - rust-lang#120569 (coverage: Improve handling of function/closure spans) - rust-lang#120572 (Update libc to 0.2.153) - rust-lang#120587 (miri: normalize struct tail in ABI compat check) - rust-lang#120607 (fix rust-lang#120603 by adding a check in default_read_buf) - rust-lang#120636 (Subtree update of `rust-analyzer`) - rust-lang#120641 (rustdoc: trait.impl, type.impl: sort impls to make it not depend on serialization order) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#120607 - conradludgate:fix-120603, r=dtolnay fix rust-lang#120603 by adding a check in default_read_buf Fixes rust-lang#120603 by checking the returned read n is in-bounds of the cursor. Interestingly, I noticed that `BorrowedBuf` side-steps this issue by using checked accesses. Maybe this can be switched to unchecked to mirror what BufReader does https://github.com/rust-lang/rust/blob/bf3c6c5bed498f41ad815641319a1ad9bcecb8e8/library/core/src/io/borrowed_buf.rs#L95
Fixes #120603 by checking the returned read n is in-bounds of the cursor.
Interestingly, I noticed that
BorrowedBuf
side-steps this issue by using checked accesses. Maybe this can be switched to unchecked to mirror what BufReader doesrust/library/core/src/io/borrowed_buf.rs
Line 95 in bf3c6c5