Bug 501194

Summary: Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any number of segment commands
Product: [Developer tools] valgrind Reporter: Paul Floyd <pjfloyd>
Component: generalAssignee: Paul Floyd <pjfloyd>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 3.24 GIT   
Target Milestone: ---   
Platform: Compiled Sources   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Paul Floyd 2025-03-07 16:10:13 UTC
Currently this function gets passed a fixed size (4k) buffer. That might not be big enough for all segment commands.

This needs to be changed so that it gets passed 'actual_fd'. Then inside ML_(check_macho_and_get_rw_loads) it should
- open the file
- allocate a buffer on the heap of size struct MACH_HEADER
- read the header
- realloc the buf with size struct MACH_HEADER + header->sizeofcmds
- process as previously
- free the buffer
- close the file
Comment 1 Paul Floyd 2025-03-07 22:12:53 UTC
commit 6999f18906f0b16d407eda3a9975cb3845dedcfe (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Fri Mar 7 23:12:13 2025 +0100

    Bug 501194 - Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any number of segment commands