address review: cap bfchar and array bfrange unicode mappings

This commit is contained in:
Dylan M. Taylor
2026-11-03 12:58:58 +00:00
parent bf24186cd8
commit 021db3bb7a
+6
View File
@@ -245,6 +245,9 @@ fn parse_cmap(data: &[u8]) -> CMap {
}
"bfchar" => {
for p in a.as_chunks::<2>().0 {
if m.unicode.len() >= MAX_UNICODE_MAPPINGS {
break;
}
if let (Obj::Str(src), Obj::Str(dst)) = (&p[0], &p[1]) {
m.unicode.insert(be(src), utf16(dst));
}
@@ -272,6 +275,9 @@ fn parse_cmap(data: &[u8]) -> CMap {
}
Obj::Array(list) => {
for (k, s) in list.iter().enumerate() {
if m.unicode.len() >= MAX_UNICODE_MAPPINGS {
break;
}
if let (Obj::Str(s), Some(c)) = (s, lo.checked_add(k as u32)) {
m.unicode.insert(c, utf16(s));
}