zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit fe61b19b9667bcd9f4ce507683bcc224d5dad1de (tree)
parent 3ea1276eebfa1cd408e9c45d1704ff294e95b807
Author: zhylmzr <zhylmzr@gmail.com>
Date:   Sun,  3 Mar 2024 00:46:55 +0800

macos: archive size fix

fixed: #19154

Diffstat:
Msrc/link/MachO/Archive.zig | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/link/MachO/Archive.zig b/src/link/MachO/Archive.zig @@ -23,11 +23,11 @@ pub fn parse(self: *Archive, macho_file: *MachO, path: []const u8, handle_index: const handle = macho_file.getFileHandle(handle_index); const offset = if (fat_arch) |ar| ar.offset else 0; - const size = if (fat_arch) |ar| ar.size else (try handle.stat()).size; + const end_pos = if (fat_arch) |ar| offset + ar.size else (try handle.stat()).size; var pos: usize = offset + SARMAG; while (true) { - if (pos >= size) break; + if (pos >= end_pos) break; if (!mem.isAligned(pos, 2)) pos += 1; var hdr_buffer: [@sizeOf(ar_hdr)]u8 = undefined;