mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-15 00:41:57 +00:00
- fixed incorrect autosegs section addresses on macOS
It appeared that getsectbyname() returns address stored in executable header as is, i.e. without adjusting it for ASLR
This commit is contained in:
parent
18b5928f49
commit
38d29c235b
1 changed files with 6 additions and 3 deletions
|
@ -49,6 +49,7 @@
|
|||
#include <dbghelp.h>
|
||||
#elif defined __MACH__
|
||||
#include <mach-o/getsect.h>
|
||||
#include <mach-o/ldsyms.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -101,10 +102,12 @@ void FAutoSeg::Initialize()
|
|||
|
||||
#elif defined __MACH__
|
||||
|
||||
if (const struct section_64 *const section = getsectbyname(AUTOSEG_MACH_SEGMENT, name))
|
||||
unsigned long size;
|
||||
|
||||
if (uint8_t *const section = getsectiondata(&_mh_execute_header, AUTOSEG_MACH_SEGMENT, name, &size))
|
||||
{
|
||||
begin = reinterpret_cast<void **>(section->addr);
|
||||
end = reinterpret_cast<void **>(section->addr + section->size);
|
||||
begin = reinterpret_cast<void **>(section);
|
||||
end = reinterpret_cast<void **>(section + size);
|
||||
}
|
||||
|
||||
#else // Linux and others with ELF executables
|
||||
|
|
Loading…
Reference in a new issue