diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -242,7 +242,8 @@ impl Elf<'_> { let phoff = usize::try_from(phoff).expect("phoff too large!"); for ph in 0..phnum { - let pos = phoff + usize::from(ph * phentsize); + let off = ph.checked_mul(phentsize).map(usize::from).expect("phdr offset overflowed"); + let pos = phoff.checked_add(off).expect("phdr position overflowed"); r.set_pos(pos); // We only care about load segments. |