Skip to content

Commit e842765

Browse files
committed
[ORC] Make a narrowing conversion explicit.
1 parent b4ac9a1 commit e842765

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class OrcRPCTPCJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
5959
auto I = HostAllocs.find(Seg);
6060
assert(I != HostAllocs.end() && "No host allocation for segment");
6161
auto &HA = I->second;
62-
return {HA.Mem.get(), HA.Size};
62+
return {HA.Mem.get(), static_cast<size_t>(HA.Size)};
6363
}
6464

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

155155
for (auto &KV : Request) {
156+
assert(KV.second.getContentSize() <= std::numeric_limits<size_t>::max() &&
157+
"Content size is out-of-range for host");
158+
156159
RMR.push_back({orcrpctpc::toWireProtectionFlags(
157160
static_cast<sys::Memory::ProtectionFlags>(KV.first)),
158161
KV.second.getContentSize() + KV.second.getZeroFillSize(),

0 commit comments

Comments
 (0)