Loading...
framework/ProcessScavenger.cpp dyld-1285.19 dyld-1330
--- dyld/dyld-1285.19/framework/ProcessScavenger.cpp
+++ dyld/dyld-1330/framework/ProcessScavenger.cpp
@@ -42,6 +42,7 @@
 #include "Header.h"
 #include "DyldSharedCache.h"
 #include "Vector.h"
+#include "SafeVMPrimitives.h"
 
 #include <sys/fsgetpath.h>
 #include <mach-o/dyld_priv.h>
@@ -146,7 +147,9 @@
             (void)vm_deallocate(mach_task_self(), (vm_address_t)localAddress, _size);
             return;
         }
+        remote_memory_audit_start();
         memcpy(_data, (void *)localAddress, _size);
+        remote_memory_audit_end();
         (void)vm_deallocate(mach_task_self(), (vm_address_t)localAddress, _size);
     }
     RemoteMap(const RemoteMap&) = delete;
@@ -285,8 +288,9 @@
         if (!mf) {
             continue;
         }
-        if (mf->machHeaderSize() > PAGE_SIZE) {
-            size_t newSize =  (size_t)lsl::roundToNextAligned(PAGE_SIZE, mf->machHeaderSize());
+        uint32_t headerSize = mf->headerAndLoadCommandsSize();
+        if (headerSize > PAGE_SIZE) {
+            size_t newSize =  (size_t)lsl::roundToNextAligned(PAGE_SIZE, headerSize);
             auto newMap = RemoteMap(task, address, newSize);
             map = std::move(newMap);
             if (!map) {