Commit 52bc9564 authored by Kenton Varda's avatar Kenton Varda
parent 7b6b7ae2
......@@ -368,7 +368,11 @@ inline SegmentReader::SegmentReader(Arena* arena, SegmentId id, const word* ptr,
readLimiter(readLimiter) {}
inline bool SegmentReader::containsInterval(const void* from, const void* to) {
return from >= this->ptr.begin() && to <= this->ptr.end() && from <= to &&
uintptr_t start = reinterpret_cast<uintptr_t>(from) - reinterpret_cast<uintptr_t>(ptr.begin());
uintptr_t end = reinterpret_cast<uintptr_t>(to) - reinterpret_cast<uintptr_t>(ptr.begin());
uintptr_t bound = ptr.size() * sizeof(capnp::word);
return start <= bound && end <= bound && start <= end &&
readLimiter->canRead(
intervalLength(reinterpret_cast<const byte*>(from),
reinterpret_cast<const byte*>(to),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment