| ... | ... | @@ -119,7 +119,8 @@ pub const InfoReader = struct { |
| 119 | 119 | switch (form) { |
| 120 | 120 | dwarf.FORM.strp => { |
| 121 | 121 | const off = try p.readOffset(cuh.format); |
| 122 | | return mem.sliceTo(@as([*:0]const u8, @ptrCast(p.strtab.ptr + off)), 0); |
| 122 | const off_u = math.cast(usize, off) orelse return error.Overflow; |
| 123 | return mem.sliceTo(@as([*:0]const u8, @ptrCast(p.strtab.ptr + off_u)), 0); |
| 123 | 124 | }, |
| 124 | 125 | dwarf.FORM.string => { |
| 125 | 126 | const start = p.pos; |
| ... | ... | @@ -163,7 +164,7 @@ pub const InfoReader = struct { |
| 163 | 164 | var stream = std.io.fixedBufferStream(p.bytes[p.pos..]); |
| 164 | 165 | var creader = std.io.countingReader(stream.reader()); |
| 165 | 166 | const value: Type = try leb.readULEB128(Type, creader.reader()); |
| 166 | | p.pos += creader.bytes_read; |
| 167 | p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow; |
| 167 | 168 | return value; |
| 168 | 169 | } |
| 169 | 170 | |
| ... | ... | @@ -171,7 +172,7 @@ pub const InfoReader = struct { |
| 171 | 172 | var stream = std.io.fixedBufferStream(p.bytes[p.pos..]); |
| 172 | 173 | var creader = std.io.countingReader(stream.reader()); |
| 173 | 174 | const value: Type = try leb.readILEB128(Type, creader.reader()); |
| 174 | | p.pos += creader.bytes_read; |
| 175 | p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow; |
| 175 | 176 | return value; |
| 176 | 177 | } |
| 177 | 178 | |
| ... | ... | @@ -226,7 +227,7 @@ pub const AbbrevReader = struct { |
| 226 | 227 | var stream = std.io.fixedBufferStream(p.bytes[p.pos..]); |
| 227 | 228 | var creader = std.io.countingReader(stream.reader()); |
| 228 | 229 | const value: Type = try leb.readULEB128(Type, creader.reader()); |
| 229 | | p.pos += creader.bytes_read; |
| 230 | p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow; |
| 230 | 231 | return value; |
| 231 | 232 | } |
| 232 | 233 | |