Bug 501194 - Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any number of segment commands
Summary: Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any number of...
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.24 GIT
Platform: Compiled Sources macOS
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-07 16:10 UTC by Paul Floyd
Modified: 2025-03-07 22:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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