ddn.elf.errors
ddn.elf.errors - ELF Error Handling and Validation Module
This module provides comprehensive error handling and validation for ELF files, including specialized exception types and validation functions at multiple levels.
Example:
try
{
ElfFile file = ElfFile(data);
validateElf(file, ValidationLevel.STANDARD);
}
catch (ElfValidationException e)
{
writeln("Validation error: ", e.msg);
}Types 6
Validation levels for ELF files.
Different levels provide different levels of strictness when validating ELF file structure.
Exception raised when ELF file format is invalid.
This is raised when file does not conform to ELF specification, such as invalid magic numbers, unknown class, or corrupted structures.
Exception raised when ELF file validation fails.
This is raised when the file format is technically valid but fails additional consistency or logical checks.
this(string msg)Constructor with error message.this(string msg, ValidationLevel level)Constructor with error message and validation level.Exception raised for I/O errors when reading/writing ELF files.
This is raised when file operations fail, such as file not found, permission denied, or read/write errors.
Exception raised when accessing data out of bounds.
This is raised when an attempt is made to access data beyond the bounds of the file or a section.
Functions 4
void validateElfHeader(const ref gelf.FileHeader ehdr, ValidationLevel level = ValidationLevel.STANDARD)Validate an ELF file header.void validateSectionHeaders(ElfFile file, ValidationLevel level = ValidationLevel.STANDARD)Validate section headers.void validateProgramHeaders(ElfFile file, ValidationLevel level = ValidationLevel.STANDARD)Validate program headers.bool validateElf(ElfFile file, ValidationLevel level = ValidationLevel.STANDARD)Comprehensively validate an ELF file.