parent
be52b4af5e
commit
64ac04567b
2 changed files with 20 additions and 0 deletions
|
@ -2559,6 +2559,7 @@ impl<T: Read> Read for Take<T> {
|
|||
|
||||
let max = cmp::min(buf.len() as u64, self.limit) as usize;
|
||||
let n = self.inner.read(&mut buf[..max])?;
|
||||
assert!(n as u64 <= self.limit, "number of read bytes exceeds limit");
|
||||
self.limit -= n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue