pub fn check_inventory<D>(dec: D, valid: &[u8]) -> Conformancewhere
D: DecoderConfig,Expand description
The structural inventory is honest and complete.
For a decoder that declares
inventory:
inventory(valid)succeeds, for the decoder’s format, covering exactlyvalid.len()bytes, passingInventory::validate, and attributing at least one part toImageData;- with 37 junk bytes appended, the inventory still validates, still covers the whole input, and attributes every appended byte to an unconsumed part: junk must never be reported as structure, image data or metadata;
- every truncation of
validyields a valid inventory without panicking or failing, because truncated and malformed input is exactly what an audit needs to see.
A decoder that does not declare the capability must return an unsupported-inventory error.
valid must be a complete file with a logical end (JPEG EOI, PNG IEND, the
last box). On a stream that is already cut short, appended bytes can
legitimately continue the cut unit (a JPEG scan without EOI reads them as
scan data), so the junk assertion doesn’t apply: for such corpus files call
Inventory::validate directly.