Skip to content

Commit

Permalink
Auto merge of rust-lang#81151 - Mark-Simulacrum:beta-next, r=Mark-Sim…
Browse files Browse the repository at this point in the history
…ulacrum

[beta] backports

This backports:

*  Update RLS and Rustfmt rust-lang#81027
*  bump rustfmt to v1.4.32 rust-lang#81093
*  Fix handling of malicious Readers in read_to_end rust-lang#80895
*  Fix broken ./x.py install rust-lang#80514
*  Fix x.py install not working with relative prefix rust-lang#80797
*  [security] Update mdbook rust-lang#80688
*  rustdoc: Render visibilities succinctly rust-lang#80368

r? `@ghost`
  • Loading branch information
bors committed Jan 20, 2021
2 parents 33b84bb + d239ea6 commit 1cd0303
Show file tree
Hide file tree
Showing 14 changed files with 301 additions and 304 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1973,9 +1973,9 @@ dependencies = [

[[package]]
name = "mdbook"
version = "0.4.3"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29be448fcafb00c5a8966c4020c2a5ffbbc333e5b96d0bb5ef54b5bd0524d9ff"
checksum = "21251d3eb9ca5e8ac5b73384ddaa483a9bbc7d7dcd656b1fa8f266634810334a"
dependencies = [
"ammonia",
"anyhow",
Expand Down
22 changes: 10 additions & 12 deletions library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ where
{
let start_len = buf.len();
let mut g = Guard { len: buf.len(), buf };
let ret;
loop {
if g.len == g.buf.len() {
unsafe {
Expand All @@ -386,21 +385,20 @@ where
}
}

match r.read(&mut g.buf[g.len..]) {
Ok(0) => {
ret = Ok(g.len - start_len);
break;
let buf = &mut g.buf[g.len..];
match r.read(buf) {
Ok(0) => return Ok(g.len - start_len),
Ok(n) => {
// We can't allow bogus values from read. If it is too large, the returned vec could have its length
// set past its capacity, or if it overflows the vec could be shortened which could create an invalid
// string if this is called via read_to_string.
assert!(n <= buf.len());
g.len += n;
}
Ok(n) => g.len += n,
Err(ref e) if e.kind() == ErrorKind::Interrupted => {}
Err(e) => {
ret = Err(e);
break;
}
Err(e) => return Err(e),
}
}

ret
}

pub(crate) fn default_read_vectored<F>(read: F, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
Expand Down
Loading

0 comments on commit 1cd0303

Please sign in to comment.