diff --git a/file/file_prefetch_buffer.cc b/file/file_prefetch_buffer.cc index 764f450c03f..315ee732682 100644 --- a/file/file_prefetch_buffer.cc +++ b/file/file_prefetch_buffer.cc @@ -856,7 +856,9 @@ bool FilePrefetchBuffer::TryReadFromCacheUntracked( if (copy_to_overlap_buffer) { buf = overlap_buf_; } + assert(buf->offset_ <= offset); uint64_t offset_in_buffer = offset - buf->offset_; + assert(n <= buf->CurrentSize() - offset_in_buffer); *result = Slice(buf->buffer_.BufferStart() + offset_in_buffer, n); if (prefetched) { readahead_size_ = std::min(max_readahead_size_, readahead_size_ * 2);