Files
AnyPS5/core/relinker/elfpatcher/tests/WindowsEntryStubAllocation.cpp
T
AdriàandClaude Sonnet 5.5 7482a5a700 test(relinker): verify entry-stub bounds before startup allocation
Replaces the source-text guard with a runtime test that tracks the largest
allocation and registers windows_entry_stub_bounds on every host.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-28 12:51:40 +01:00

17 lines
507 B
C++

#include <cstddef>
#include <cstdlib>
#include <new>
namespace WindowsEntryStubAllocation {
std::size_t largest = 0;
}
void* operator new(std::size_t size) {
if (size > WindowsEntryStubAllocation::largest) WindowsEntryStubAllocation::largest = size;
if (void* memory = std::malloc(size == 0 ? 1 : size)) return memory;
throw std::bad_alloc();
}
void operator delete(void* memory) noexcept { std::free(memory); }
void operator delete(void* memory, std::size_t) noexcept { std::free(memory); }