| 77 | const std::string& name() const override { return name_; } |
| 78 | |
| 79 | std::size_t read(u64 offset, void* out, std::size_t len) const override { |
| 80 | if (offset >= size_) return 0; |
| 81 | // Overflow-safe clamp: `offset + len` can wrap for a huge len and skip |
| 82 | // the bound, letting memcpy read past the mapped view (OOB). offset < |
| 83 | // size_ here, so `size_ - offset` is always a safe positive bound. |
| 84 | if (len > size_ - offset) len = static_cast<std::size_t>(size_ - offset); |
| 85 | // Page-fault on demand; OS prefetcher handles streaming patterns. |
| 86 | std::memcpy(out, static_cast<const u8*>(view_) + offset, len); |
| 87 | return len; |
| 88 | } |
| 89 | |
| 90 | private: |
| 91 | std::string name_; |
nothing calls this directly
no outgoing calls
no test coverage detected