Skip to main content

Walk

Struct Walk 

Source
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: u64

Offsets stored in the TIFF are relative to this.

§lay: Layout§magic: u16

The TIFF version number from the header (42, 43, or a raw variant).

§header: Range<u64>§header_ok: bool

Whether 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: u64

Entries this walk may still parse. Disjoint entries cannot exceed limit / 12, so only overlapping or repeated IFDs (crafted files) run it out.

§cancelled: bool

Whether Rules::cancelled stopped the walk.

§budget_hit: bool

Whether a budget or cap stopped part of the walk: its gaps may hold bytes the decoder reads.

§pointer_reads: u64

Directory pointers read from pointer entries (Rules::pointer_offsets), the walk’s work on pointer arrays; the crates’ tests bound it.

Implementations§

Source§

impl Walk<'_>

Source

pub fn limit(&self) -> u64

Source

pub fn take_scan(&self, n: u64) -> bool

Take n bytes from the count-only scan budget; false once it is spent.

Source

pub fn abs(&self, off: u64) -> Option<u64>

The absolute position of a TIFF-relative offset.

Source

pub fn loc(&self, e: &Entry) -> Loc

Source

pub fn bytes(&self, e: &Entry) -> Option<&[u8]>

The value’s bytes, when they lie inside the TIFF.

Source

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.

Source

pub fn single_uint(&self, e: &Entry) -> Option<u64>

The single unsigned value of a one-element integer entry.

Source

pub fn find<'i>(&self, ifd: &'i Ifd, tag: u16) -> Option<&'i Entry>

The last entry with tag (decoders keeping a map keep the last of duplicate tags).

Auto Trait Implementations§

§

impl<'a> !Freeze for Walk<'a>

§

impl<'a> !RefUnwindSafe for Walk<'a>

§

impl<'a> !Sync for Walk<'a>

§

impl<'a> Send for Walk<'a>

§

impl<'a> Unpin for Walk<'a>

§

impl<'a> UnsafeUnpin for Walk<'a>

§

impl<'a> UnwindSafe for Walk<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.