LibPDF: Reject CFFs with more than one font

The code assumes that there's just one Top DICT, so let's be loud
when that isn't the case.
This commit is contained in:
Nico Weber 2023-10-12 10:20:54 -04:00 committed by Andreas Kling
commit c825194fb9
Notes: sideshowbarker 2024-07-17 03:30:41 +09:00

View file

@ -64,6 +64,9 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
return TRY(font_names.try_append(font_name));
}));
if (font_names.size() != 1)
return error("CFFs with more than one font not yet implemented");
auto cff = adopt_ref(*new CFF());
cff->set_font_matrix({ 0.001f, 0.0f, 0.0f, 0.001f, 0.0f, 0.0f });