Skip to content

Commit 13f278a

Browse files
tool: fix potential integer overflow when parsing ELFs
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
1 parent 9a8aba7 commit 13f278a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tool/microkit/src/elf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl ElfFile {
226226
let mut symtab_shent: Option<&ElfSectionHeader64> = None;
227227
let mut shstrtab_shent: Option<&ElfSectionHeader64> = None;
228228
for i in 0..hdr.shnum {
229-
let shent_start = hdr.shoff + (i * hdr.shentsize) as u64;
229+
let shent_start = hdr.shoff + (i as u64 * hdr.shentsize as u64);
230230
let shent_end = shent_start + hdr.shentsize as u64;
231231
let shent_bytes = &bytes[shent_start as usize..shent_end as usize];
232232

0 commit comments

Comments
 (0)