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