| ... | @@ -5003,7 +5003,8 @@ fn writeSyntheticSectionsObject(self: *Elf) !void { | ... | @@ -5003,7 +5003,8 @@ fn writeSyntheticSectionsObject(self: *Elf) !void { |
| 5003 | | 5003 | |
| 5004 | const shdr = self.shdrs.items[sec.shndx]; | 5004 | const shdr = self.shdrs.items[sec.shndx]; |
| 5005 | | 5005 | |
| 5006 | const num_relocs = @divExact(shdr.sh_size, shdr.sh_entsize); | 5006 | const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse |
| | 5007 | return error.Overflow; |
| 5007 | var relocs = try std.ArrayList(elf.Elf64_Rela).initCapacity(gpa, num_relocs); | 5008 | var relocs = try std.ArrayList(elf.Elf64_Rela).initCapacity(gpa, num_relocs); |
| 5008 | defer relocs.deinit(); | 5009 | defer relocs.deinit(); |
| 5009 | | 5010 | |