pub fn decode_guarded(
decoder: &dyn Decoder,
bytes: &[u8],
ext: &str,
) -> Result<DecodedImage, MediaError>Expand description
Run decoder.decode with the unwind boundary an import needs.
A pre-1.0 decoder fed untrusted bytes is exactly where a panic is plausible, and a missing
thumbnail must never be able to abort an import that has already written signed, encrypted
bytes. A caught unwind becomes MediaError::DecoderPanic — reported, not swallowed.