pub struct Walk<'a> {Show 13 fields
pub d: &'a [u8],
pub base: u64,
pub lay: Layout,
pub magic: u16,
pub header: Range<u64>,
pub header_ok: bool,
pub header_ext: Option<(Range<u64>, Disposition, String)>,
pub fatal: Option<String>,
pub ifds: Vec<Ifd>,
pub entries_left: u64,
pub cancelled: bool,
pub budget_hit: bool,
pub pointer_reads: u64,
/* private fields */
}Expand description
One parsed TIFF.
Fields§
§d: &'a [u8]The input up to the TIFF’s limit; positions are absolute.
base: u64Offsets stored in the TIFF are relative to this.
lay: Layout§magic: u16The TIFF version number from the header (42, 43, or a raw variant).
header: Range<u64>§header_ok: boolWhether the header parsed completely.
header_ext: Option<(Range<u64>, Disposition, String)>Bytes after the header that belong to the file format (CR2), with their disposition and detail.
fatal: Option<String>Why the header or IFD0 could not be read.
ifds: Vec<Ifd>§entries_left: u64Entries this walk may still parse. Disjoint entries cannot exceed
limit / 12, so only overlapping or repeated IFDs (crafted files)
run it out.
cancelled: boolWhether Rules::cancelled stopped the walk.
budget_hit: boolWhether a budget or cap stopped part of the walk: its gaps may hold bytes the decoder reads.
pointer_reads: u64Directory pointers read from pointer entries (Rules::pointer_offsets),
the walk’s work on pointer arrays; the crates’ tests bound it.
Implementations§
Source§impl Walk<'_>
impl Walk<'_>
pub fn limit(&self) -> u64
Sourcepub fn take_scan(&self, n: u64) -> bool
pub fn take_scan(&self, n: u64) -> bool
Take n bytes from the count-only scan budget; false once it is
spent.
pub fn loc(&self, e: &Entry) -> Loc
Sourcepub fn bytes(&self, e: &Entry) -> Option<&[u8]>
pub fn bytes(&self, e: &Entry) -> Option<&[u8]>
The value’s bytes, when they lie inside the TIFF.
Sourcepub fn uints(&self, e: &Entry, max: usize) -> Vec<u64>
pub fn uints(&self, e: &Entry, max: usize) -> Vec<u64>
Unsigned integer values (BYTE, UNDEFINED, SHORT, LONG, IFD, LONG8,
IFD8), at most max of them; other types yield nothing.
Sourcepub fn single_uint(&self, e: &Entry) -> Option<u64>
pub fn single_uint(&self, e: &Entry) -> Option<u64>
The single unsigned value of a one-element integer entry.