From c825194fb9430abd8973734468609dd2f0acfa98 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 12 Oct 2023 10:20:54 -0400 Subject: [PATCH] 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. --- Userland/Libraries/LibPDF/Fonts/CFF.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibPDF/Fonts/CFF.cpp b/Userland/Libraries/LibPDF/Fonts/CFF.cpp index de377affa2..b88b483109 100644 --- a/Userland/Libraries/LibPDF/Fonts/CFF.cpp +++ b/Userland/Libraries/LibPDF/Fonts/CFF.cpp @@ -64,6 +64,9 @@ PDFErrorOr> 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 });