Skip to content

Commit

Permalink
[ORC] Make a narrowing conversion explicit.
Browse files Browse the repository at this point in the history
  • Loading branch information
lhames committed Nov 13, 2020
1 parent b4ac9a1 commit e842765
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -59,7 +59,7 @@ class OrcRPCTPCJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
auto I = HostAllocs.find(Seg);
assert(I != HostAllocs.end() && "No host allocation for segment");
auto &HA = I->second;
return {HA.Mem.get(), HA.Size};
return {HA.Mem.get(), static_cast<size_t>(HA.Size)};
}

JITTargetAddress getTargetMemory(ProtectionFlags Seg) override {
Expand Down Expand Up @@ -153,6 +153,9 @@ class OrcRPCTPCJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
HostAllocMap HostAllocs;

for (auto &KV : Request) {
assert(KV.second.getContentSize() <= std::numeric_limits<size_t>::max() &&
"Content size is out-of-range for host");

RMR.push_back({orcrpctpc::toWireProtectionFlags(
static_cast<sys::Memory::ProtectionFlags>(KV.first)),
KV.second.getContentSize() + KV.second.getZeroFillSize(),
Expand Down

0 comments on commit e842765

Please sign in to comment.