| ... | ... | @@ -3399,15 +3399,15 @@ pub fn writeMergeSections(self: *Elf) !void { |
| 3399 | 3399 | |
| 3400 | 3400 | for (self.merge_sections.items) |msec| { |
| 3401 | 3401 | const shdr = self.shdrs.items[msec.output_section_index]; |
| 3402 | | |
| 3403 | | try buffer.ensureTotalCapacity(shdr.sh_size); |
| 3404 | | buffer.appendNTimesAssumeCapacity(0, shdr.sh_size); |
| 3402 | const size = math.cast(usize, shdr.sh_size) orelse return error.Overflow; |
| 3403 | try buffer.ensureTotalCapacity(size); |
| 3404 | buffer.appendNTimesAssumeCapacity(0, size); |
| 3405 | 3405 | |
| 3406 | 3406 | for (msec.subsections.items) |msub_index| { |
| 3407 | 3407 | const msub = self.mergeSubsection(msub_index); |
| 3408 | 3408 | assert(msub.alive); |
| 3409 | 3409 | const string = msub.getString(self); |
| 3410 | | const off: u64 = @intCast(msub.value); |
| 3410 | const off = math.cast(usize, msub.value) orelse return error.Overflow; |
| 3411 | 3411 | @memcpy(buffer.items[off..][0..string.len], string); |
| 3412 | 3412 | } |
| 3413 | 3413 | |