diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-05-24 23:06:27 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-05-24 23:06:27 +0200 |
| commit | 42c058575e2be291e351fe7dd4fdd6f5e4b9b703 (patch) | |
| tree | 231eda19a406df41bf4022973cca0943b6e86729 /src | |
| parent | 19f41d390f6761885c836be9c1a57efc8e81a606 (diff) | |
| download | zig-42c058575e2be291e351fe7dd4fdd6f5e4b9b703.tar.gz zig-42c058575e2be291e351fe7dd4fdd6f5e4b9b703.zip | |
link/macho: fix 32bit build
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/MachO/dwarf.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/link/MachO/dwarf.zig b/src/link/MachO/dwarf.zig index 2b4977aebe..018c40f779 100644 --- a/src/link/MachO/dwarf.zig +++ b/src/link/MachO/dwarf.zig @@ -119,7 +119,8 @@ pub const InfoReader = struct { switch (form) { dwarf.FORM.strp => { const off = try p.readOffset(cuh.format); - return mem.sliceTo(@as([*:0]const u8, @ptrCast(p.strtab.ptr + off)), 0); + const off_u = math.cast(usize, off) orelse return error.Overflow; + return mem.sliceTo(@as([*:0]const u8, @ptrCast(p.strtab.ptr + off_u)), 0); }, dwarf.FORM.string => { const start = p.pos; @@ -163,7 +164,7 @@ pub const InfoReader = struct { var stream = std.io.fixedBufferStream(p.bytes[p.pos..]); var creader = std.io.countingReader(stream.reader()); const value: Type = try leb.readULEB128(Type, creader.reader()); - p.pos += creader.bytes_read; + p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow; return value; } @@ -171,7 +172,7 @@ pub const InfoReader = struct { var stream = std.io.fixedBufferStream(p.bytes[p.pos..]); var creader = std.io.countingReader(stream.reader()); const value: Type = try leb.readILEB128(Type, creader.reader()); - p.pos += creader.bytes_read; + p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow; return value; } @@ -226,7 +227,7 @@ pub const AbbrevReader = struct { var stream = std.io.fixedBufferStream(p.bytes[p.pos..]); var creader = std.io.countingReader(stream.reader()); const value: Type = try leb.readULEB128(Type, creader.reader()); - p.pos += creader.bytes_read; + p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow; return value; } |
