Skip to main content

program_load_data_readable

Function program_load_data_readable 

Source
pub open spec fn program_load_data_readable(
    header: &ProgramHeader<'_>,
    input: Seq<u8>,
) -> bool
Expand description
{
    let offset = header.offset();
    let size = header.file_size();
    size == 0
        || {
            &&& match *header {
                ProgramHeader::Ph32(_) => offset + size <= u32::MAX,
                ProgramHeader::Ph64(_) => offset + size <= u64::MAX,
            }
            &&& offset + size <= usize::MAX
            &&& offset + size <= input.len()

        }
}

raw_data adds the source fields before casting to usize. In ELF32 that addition is u32, even on a 64-bit host. Empty data bypasses the offset.