Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/unzip/cloneable_seekable_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ impl<R: Read + Seek> Inner<R> {
}
let read_result = self.r.read(buf);
if let Ok(bytes_read) = read_result {
// TODO, once stabilised, use checked_add_signed
self.pos += bytes_read as u64;
self.pos = self
.pos
.checked_add(bytes_read as u64)
.ok_or(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"Read too far forward",
))?;
}
read_result
}
Expand Down