From 0ed6ccd8060ff69b6da79dd63c323eb5fa69e4cc Mon Sep 17 00:00:00 2001 From: Evgeniy Kazakov Date: Tue, 17 Dec 2024 02:50:55 +0300 Subject: [PATCH] Align trampoline to 2 bytes to pass mfp check --- src/allocator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/allocator.cpp b/src/allocator.cpp index 4a46f1c..08504d5 100644 --- a/src/allocator.cpp +++ b/src/allocator.cpp @@ -84,6 +84,10 @@ void Allocator::free(uint8_t* address, size_t size) { std::expected Allocator::internal_allocate_near( const std::vector& desired_addresses, size_t size, size_t max_distance) { + // Align to 2 bytes to pass MFP virtual method check + // See https://itanium-cxx-abi.github.io/cxx-abi/abi.html#member-function-pointers + size = align_up(size, 2); + // First search through our list of allocations for a free block that is large // enough. for (const auto& allocation : m_memory) {