Skip to main content

parse_boxes_tolerant

Function parse_boxes_tolerant 

Source
pub fn parse_boxes_tolerant<R: Read + Seek>(
    r: &mut R,
    start: u64,
    end: u64,
) -> Result<(Vec<BoxRef>, Vec<ParseIssue>)>
Expand description

Like parse_boxes, but recovers from malformed boxes instead of aborting: the tree parsed so far is returned together with a list of ParseIssues describing what was wrong and where.

Damage is contained to the enclosing container: an unreadable child header abandons the rest of that container’s bytes, while siblings of the container and everything above it keep parsing. A box whose interior fails to parse is downgraded to an opaque leaf. Boxes whose declared size overruns their parent are clamped (as in strict mode) and reported.

Only returns Err for I/O failures on the initial seek.