pub enum ParseError {
Show 16 variants
BadMagic([u8; 4]),
UnsupportedElfClass(u8),
UnsupportedElfEndianness(u8),
UnsupportedVersion((u64, u64)),
BadOffset(u64),
StringTableMissingNul(u64),
BadEntsize((u64, u64)),
UnexpectedSectionType((u32, u32)),
UnexpectedSegmentType((u32, u32)),
UnexpectedAlignment(usize),
SliceReadError((usize, usize)),
IntegerOverflow,
Utf8Error(Utf8Error),
TryFromSliceError(TryFromSliceError),
TryFromIntError(TryFromIntError),
IOError(Error),
}
Variants§
BadMagic([u8; 4])
Returned when the ELF File Header’s magic bytes weren’t ELF’s defined magic bytes
UnsupportedElfClass(u8)
Returned when the ELF File Header’s e_ident[EI_CLASS]
wasn’t one of the
defined ELFCLASS*
constants
UnsupportedElfEndianness(u8)
Returned when the ELF File Header’s e_ident[EI_DATA]
wasn’t one of the
defined ELFDATA*
constants
UnsupportedVersion((u64, u64))
Returned when parsing an ELF struct with a version field whose value wasn’t something we support and know how to parse.
BadOffset(u64)
Returned when parsing an ELF structure resulted in an offset which fell out of bounds of the requested structure
StringTableMissingNul(u64)
Returned when parsing a string out of a StringTable failed to find the terminating NUL byte
BadEntsize((u64, u64))
Returned when parsing a table of ELF structures and the file specified an entry size for that table that was different than what we had expected
UnexpectedSectionType((u32, u32))
Returned when trying to interpret a section’s data as the wrong type. For example, trying to treat an SHT_PROGBIGS section as a SHT_STRTAB.
UnexpectedSegmentType((u32, u32))
Returned when trying to interpret a segment’s data as the wrong type. For example, trying to treat an PT_LOAD section as a PT_NOTE.
UnexpectedAlignment(usize)
Returned when a section has a sh_addralign value that was different than we expected.
SliceReadError((usize, usize))
Returned when parsing an ELF structure out of an in-memory &[u8]
resulted in a request for a section of file bytes outside the range of
the slice. Commonly caused by truncated file contents.
IntegerOverflow
Returned when doing math with parsed elf fields that resulted in integer overflow.
Utf8Error(Utf8Error)
Returned when parsing a string out of a StringTable that contained invalid Utf8
TryFromSliceError(TryFromSliceError)
Returned when parsing an ELF structure and the underlying structure data was truncated and thus the full structure contents could not be parsed.
TryFromIntError(TryFromIntError)
Returned when parsing an ELF structure whose on-disk fields were too big to represent in the native machine’s usize type for in-memory processing. This could be the case when processessing large 64-bit files on a 32-bit machine.
IOError(Error)
Returned when parsing an ELF structure out of an io stream encountered an io error.