Skip to content

Automate check_parser_state in BoxIter loops #246

@baumanj

Description

@baumanj

By convention, the check_parser_state macro is called at the end of while loops for iterating over BMFFBox's sub boxes with BoxIter like so:

let mut iter = src.box_iter();
while let Some(mut b) = iter.next_box()? {
    // read or skip all the contents of `b`
    check_parser_state!(b.content);
}

This helps to surface the situation of failing to read boxes in their entirety either due to logic errors or malformed input. However, it can be easy to forget to add the check_parser_state macro in the appropriate place, so some form of automation would improve the robustness of the codebase.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions