diff --git a/vendor/hayro-interpret/src/x_object.rs b/vendor/hayro-interpret/src/x_object.rs index a772233f2..e12767400 100644 --- a/vendor/hayro-interpret/src/x_object.rs +++ b/vendor/hayro-interpret/src/x_object.rs @@ -83,7 +83,10 @@ impl<'a> FormXObject<'a> { // PdfCraft patch: see `context::MAX_PAGE_CONTENT`. let decoded = crate::context::decode_content(stream)?; - let resources = dict.get::>(RESOURCES); + // PdfCraft patch: retain absence; present malformed dictionaries stay local-empty. + let resources = dict + .contains_key(RESOURCES) + .then(|| dict.get::>(RESOURCES).unwrap_or_default()); let matrix = Affine::new( dict.get::<[f64; 6]>(MATRIX) @@ -611,9 +614,14 @@ impl<'a> ImageXObject<'a> { default_space = Some(key); Some(space) } else { + // PdfCraft patch (80): an Indexed space given in place whose `hival` has no + // reading cannot be built and falls back below, as upstream; it is reported. + malformed_indexed = cs_obj + .as_ref() + .is_some_and(crate::color::has_unusable_hival); cs_obj .clone() - .and_then(|c| ColorSpace::new(c, cache)) + .and_then(|c| ColorSpace::new_allowing_tableless(c, cache)) // Inline images can also refer to color spaces by name. .or_else(|| { cs_obj