diff options
Diffstat (limited to 'tvix/store/src/blobservice/dumb_seeker.rs')
-rw-r--r-- | tvix/store/src/blobservice/dumb_seeker.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tvix/store/src/blobservice/dumb_seeker.rs b/tvix/store/src/blobservice/dumb_seeker.rs index 5548ea0bd33d..8629394d21bc 100644 --- a/tvix/store/src/blobservice/dumb_seeker.rs +++ b/tvix/store/src/blobservice/dumb_seeker.rs @@ -80,7 +80,17 @@ impl<R: io::Read> io::Seek for DumbSeeker<R> { Err(e) => return Err(e), } } - debug_assert_eq!(bytes_to_skip, bytes_skipped); + + // This will fail when seeking past the end of self.r + if bytes_to_skip != bytes_skipped { + return Err(std::io::Error::new( + std::io::ErrorKind::UnexpectedEof, + format!( + "tried to skip {} bytes, but only was able to skip {} until reaching EOF", + bytes_to_skip, bytes_skipped + ), + )); + } self.pos = absolute_offset; |