Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ where
const ET_EXEC: u16 = 0x0002;
/// Standard ELF magic header
const ELF_MAGIC: u32 = 0x7F454C46;
/// 32-bit, little-endian, version 1, SysV
/// 32-bit, little-endian, version 1, low OS byte ignored.
const DESIRED_ELF_VERSION: u32 = 0x01010100;

/// Make a new loader
Expand All @@ -98,7 +98,8 @@ where
// File doesn't start 0x7F E L F
return Err(Error::NotAnElfFile);
}
let class_endian_version_abi = data_source.read_u32_be(0x04)?;
// Mask out the OS byte which varies between Rust compiler versions.
let class_endian_version_abi = data_source.read_u32_be(0x04)? & 0xffffff00;
if class_endian_version_abi != Self::DESIRED_ELF_VERSION {
return Err(Error::WrongElfFile);
}
Expand Down Expand Up @@ -156,15 +157,15 @@ where
}

/// Create a section header iterator.
pub fn iter_section_headers(&self) -> IterSectionHeaders<DS> {
pub fn iter_section_headers(&self) -> IterSectionHeaders<'_, DS> {
IterSectionHeaders {
parent: self,
next_section: 0,
}
}

/// Create a program header iterator.
pub fn iter_program_headers(&self) -> IterProgramHeaders<DS> {
pub fn iter_program_headers(&self) -> IterProgramHeaders<'_, DS> {
IterProgramHeaders {
parent: self,
next_program_header: 0,
Expand Down
Loading