Skip to content

Commit

Permalink
JITASM.cpp: add assert for code building
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jan 25, 2025
1 parent 3f42104 commit 6fc643f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Utilities/JITASM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ void* jit_runtime_base::_add(asmjit::CodeHolder* code, usz align) noexcept

for (asmjit::Section* section : code->_sections)
{
if (section->offset() + section->bufferSize() > utils::align<usz>(codeSize, align))
{
fmt::throw_exception("CodeHolder section exceeds range: Section->offset: 0x%x, Section->bufferSize: 0x%x, alloted-memory=0x%x", section->offset(), section->bufferSize(), utils::align<usz>(codeSize, align));
}

std::memcpy(p + section->offset(), section->data(), section->bufferSize());
}
}
Expand Down

0 comments on commit 6fc643f

Please sign in to comment.