MachoOpenFromMemoryCopy
Description
Parse a Mach-O image from an in-memory byte range – R-value / copy form (mirrors VecInsertR).
Parser allocates its own buffer through alloc and MemCopys the caller’s bytes in. Caller’s pointer is never retained; their buffer remains theirs.
Success
Returns true; out owns an independent copy of data.
Failure
Returns false; out zeroed; caller’s data untouched.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
MachO.c:127:
Macho m;
bool ok = MachoOpenFromMemoryCopy(&m, blob, sizeof(blob), base);
if (!ok) {
DefaultAllocatorDeinit(&alloc);- In
MachO.c:156:
Macho m;
if (!MachoOpenFromMemoryCopy(&m, blob, sizeof(blob), base)) {
DefaultAllocatorDeinit(&alloc);
return false;- In
MachO.c:187:
Macho m;
bool ok = !MachoOpenFromMemoryCopy(&m, fat, sizeof(fat), base);
DefaultAllocatorDeinit(&alloc);- In
MachO.c:431:
bool macho_open_from_memory_copy(Macho *out, const u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_FATAL("MachoOpenFromMemoryCopy: NULL argument (contract violation)");
}
Buf copy = BufInit(alloc);- In
MachO.c:435:
Buf copy = BufInit(alloc);
if (!VecReserve(©, (u64)data_size)) {
LOG_ERROR("MachoOpenFromMemoryCopy: allocation failed ({} bytes)", (u64)data_size);
return false;
}
Last updated on