Skip to content

Commit 2b5f824

Browse files
committed
tool: return error on ELF word size other than 64
Signed-off-by: Nick Spinale <nick@nickspinale.com>
1 parent 649f292 commit 2b5f824

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tool/microkit/src/elf.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ impl ElfFile {
218218
}
219219
};
220220

221+
if word_size != 64 {
222+
return Err(format!(
223+
"ELF '{}': unsupported word size: '{}'",
224+
path.display(),
225+
word_size
226+
));
227+
}
228+
221229
// Now need to read the header into a struct
222230
let hdr_bytes = &bytes[..hdr_size];
223231
let hdr = unsafe { bytes_to_struct::<ElfHeader64>(hdr_bytes) };

0 commit comments

Comments
 (0)