diff --git a/util/io_posix.cc b/util/io_posix.cc index 426d2c560..111f899ee 100644 --- a/util/io_posix.cc +++ b/util/io_posix.cc @@ -105,6 +105,11 @@ Status ReadAligned(int fd, Slice* data, const uint64_t offset, break; } bytes_read += status; + if (status % static_cast(kSectorSize) != 0) { + // Bytes reads don't fill sectors. Should only happen at the end + // of the file. + break; + } } *data = Slice(scratch, bytes_read);