diff --git a/vendor/hayro-cmap/src/lib.rs b/vendor/hayro-cmap/src/lib.rs index c45cc0ae54..4eb88f5053 100644 --- a/vendor/hayro-cmap/src/lib.rs +++ b/vendor/hayro-cmap/src/lib.rs @@ -1125,6 +1125,18 @@ endbfchar assert!(CMap::parse(b"<00", |_| None).is_none()); } + #[test] + fn truncated_stream_with_only_metadata_reports_failure() { + // Character-collection metadata alone is not a usable CMap: an empty + // metadata-only map would block the caller's fallback paths, so a + // truncated stream with no mappings must report failure here too. + assert!(CMap::parse( + b"/Registry (Adobe) /Ordering (Japan1) /Supplement 0 <00", + |_| None + ) + .is_none()); + } + #[test] fn bad_bfchar_code_keeps_later_entries_aligned() { // The malformed 5-byte code still has a destination object; both diff --git a/vendor/hayro-cmap/src/parse.rs b/vendor/hayro-cmap/src/parse.rs index 9450bbbe2d..2a89fdbac7 100644 --- a/vendor/hayro-cmap/src/parse.rs +++ b/vendor/hayro-cmap/src/parse.rs @@ -154,7 +154,6 @@ pub(crate) fn parse_inner<'a>( && notdef_ranges.is_empty() && bf_entries.is_empty() && base.is_none() - && metadata.character_collection.is_none() { return None; }