mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
add SHT_NOBITS check
This commit is contained in:
parent
f0bac8037c
commit
9097bcc06e
@ -84,9 +84,11 @@ pub fn parse(self: *SharedObject, elf_file: *Elf) !void {
|
||||
try self.shdrs.ensureTotalCapacityPrecise(gpa, shdrs.len);
|
||||
|
||||
for (shdrs, 0..) |shdr, i| {
|
||||
if (self.data.len < shdr.sh_offset or self.data.len < shdr.sh_offset + shdr.sh_size) {
|
||||
try elf_file.reportParseError2(self.index, "corrupted section header", .{});
|
||||
return error.MalformedObject;
|
||||
if (shdr.sh_type != elf.SHT_NOBITS) {
|
||||
if (self.data.len < shdr.sh_offset or self.data.len < shdr.sh_offset + shdr.sh_size) {
|
||||
try elf_file.reportParseError2(self.index, "corrupted section header", .{});
|
||||
return error.MalformedObject;
|
||||
}
|
||||
}
|
||||
self.shdrs.appendAssumeCapacity(try ElfShdr.fromElf64Shdr(shdr));
|
||||
switch (shdr.sh_type) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user