Commit c1c3212500

LemonBoy <thatlemon@gmail.com>
2020-09-15 13:13:42
std: Fix typo in ELF section header iterator
The code accidentally used the phdr offset instead of the shdr one while iterating over the section headers. Fixes #6338
1 parent 5e39ab4
Changed files (1)
lib
lib/std/elf.zig
@@ -471,7 +471,7 @@ pub const SectionHeaderIterator = struct {
 
         if (self.elf_header.is_64) {
             var shdr: Elf64_Shdr = undefined;
-            const offset = self.elf_header.phoff + @sizeOf(@TypeOf(shdr)) * self.index;
+            const offset = self.elf_header.shoff + @sizeOf(@TypeOf(shdr)) * self.index;
             try preadNoEof(self.file, mem.asBytes(&shdr), offset);
 
             // ELF endianness matches native endianness.