forked from OSchip/llvm-project
Add parens to force the order of operations in an expression trying
to do "databuffer + offset" so that we don't overflow the uint64_t's we're using for addresses when working with high addresses. Found with clang's ubsan while doing darwin kernel debugging. <rdar://problem/48728940> llvm-svn: 355761
This commit is contained in:
parent
411210838d
commit
cee6c47a62
|
@ -146,7 +146,7 @@ size_t MemoryCache::Read(addr_t addr, void *dst, size_t dst_len,
|
||||||
}
|
}
|
||||||
AddrRange chunk_range(pos->first, pos->second->GetByteSize());
|
AddrRange chunk_range(pos->first, pos->second->GetByteSize());
|
||||||
if (chunk_range.Contains(read_range)) {
|
if (chunk_range.Contains(read_range)) {
|
||||||
memcpy(dst, pos->second->GetBytes() + addr - chunk_range.GetRangeBase(),
|
memcpy(dst, pos->second->GetBytes() + (addr - chunk_range.GetRangeBase()),
|
||||||
dst_len);
|
dst_len);
|
||||||
return dst_len;
|
return dst_len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue