| ... | ... | @@ -84,9 +84,11 @@ pub fn parse(self: *SharedObject, elf_file: *Elf) !void { |
| 84 | 84 | try self.shdrs.ensureTotalCapacityPrecise(gpa, shdrs.len); |
| 85 | 85 | |
| 86 | 86 | for (shdrs, 0..) |shdr, i| { |
| 87 | | if (self.data.len < shdr.sh_offset or self.data.len < shdr.sh_offset + shdr.sh_size) { |
| 88 | | try elf_file.reportParseError2(self.index, "corrupted section header", .{}); |
| 89 | | return error.MalformedObject; |
| 87 | if (shdr.sh_type != elf.SHT_NOBITS) { |
| 88 | if (self.data.len < shdr.sh_offset or self.data.len < shdr.sh_offset + shdr.sh_size) { |
| 89 | try elf_file.reportParseError2(self.index, "corrupted section header", .{}); |
| 90 | return error.MalformedObject; |
| 91 | } |
| 90 | 92 | } |
| 91 | 93 | self.shdrs.appendAssumeCapacity(try ElfShdr.fromElf64Shdr(shdr)); |
| 92 | 94 | switch (shdr.sh_type) { |