@@ -584,7 +584,8 @@ pub const ProgramHeaderIterator = struct {
584
584
if (it .index >= it .elf_header .phnum ) return null ;
585
585
defer it .index += 1 ;
586
586
587
- const offset = it .elf_header .phoff + if (it .elf_header .is_64 ) @sizeOf (Elf64_Phdr ) else @sizeOf (Elf32_Phdr ) * it .index ;
587
+ const size : u64 = if (it .elf_header .is_64 ) @sizeOf (Elf64_Phdr ) else @sizeOf (Elf32_Phdr );
588
+ const offset = it .elf_header .phoff + size * it .index ;
588
589
try it .file_reader .seekTo (offset );
589
590
590
591
return takePhdr (& it .file_reader .interface , it .elf_header );
@@ -600,7 +601,8 @@ pub const ProgramHeaderBufferIterator = struct {
600
601
if (it .index >= it .elf_header .phnum ) return null ;
601
602
defer it .index += 1 ;
602
603
603
- const offset = it .elf_header .phoff + if (it .elf_header .is_64 ) @sizeOf (Elf64_Phdr ) else @sizeOf (Elf32_Phdr ) * it .index ;
604
+ const size : u64 = if (it .elf_header .is_64 ) @sizeOf (Elf64_Phdr ) else @sizeOf (Elf32_Phdr );
605
+ const offset = it .elf_header .phoff + size * it .index ;
604
606
var reader = std .Io .Reader .fixed (it .buf [offset .. ]);
605
607
606
608
return takePhdr (& reader , it .elf_header );
@@ -635,7 +637,8 @@ pub const SectionHeaderIterator = struct {
635
637
if (it .index >= it .elf_header .shnum ) return null ;
636
638
defer it .index += 1 ;
637
639
638
- const offset = it .elf_header .shoff + if (it .elf_header .is_64 ) @sizeOf (Elf64_Shdr ) else @sizeOf (Elf32_Shdr ) * it .index ;
640
+ const size : u64 = if (it .elf_header .is_64 ) @sizeOf (Elf64_Shdr ) else @sizeOf (Elf32_Shdr );
641
+ const offset = it .elf_header .shoff + size * it .index ;
639
642
try it .file_reader .seekTo (offset );
640
643
641
644
return takeShdr (& it .file_reader .interface , it .elf_header );
@@ -651,7 +654,8 @@ pub const SectionHeaderBufferIterator = struct {
651
654
if (it .index >= it .elf_header .shnum ) return null ;
652
655
defer it .index += 1 ;
653
656
654
- const offset = it .elf_header .shoff + if (it .elf_header .is_64 ) @sizeOf (Elf64_Shdr ) else @sizeOf (Elf32_Shdr ) * it .index ;
657
+ const size : u64 = if (it .elf_header .is_64 ) @sizeOf (Elf64_Shdr ) else @sizeOf (Elf32_Shdr );
658
+ const offset = it .elf_header .shoff + size * it .index ;
655
659
var reader = std .Io .Reader .fixed (it .buf [offset .. ]);
656
660
657
661
return takeShdr (& reader , it .elf_header );
0 commit comments