From a1af79dca623bc7393aa8458bca1e11ec4d46301 Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Fri, 16 Dec 2022 00:18:50 +0800 Subject: [PATCH] LibPDF: Follow a FontFile's Length values These can be references (at least from what I've found in some documents), so we want to resolve them before using them. --- Userland/Libraries/LibPDF/Fonts/Type1Font.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp b/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp index 89f64ec45d..e1beb93e6a 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp +++ b/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp @@ -27,8 +27,8 @@ PDFErrorOr Type1Font::parse_data(Document* document, NonnullRef if (!font_file_dict->contains(CommonNames::Length1, CommonNames::Length2)) return Error { Error::Type::Parse, "Embedded type 1 font is incomplete" }; - auto length1 = font_file_dict->get_value(CommonNames::Length1).get(); - auto length2 = font_file_dict->get_value(CommonNames::Length2).get(); + auto length1 = TRY(document->resolve(font_file_dict->get_value(CommonNames::Length1))).get(); + auto length2 = TRY(document->resolve(font_file_dict->get_value(CommonNames::Length2))).get(); data.font_program = adopt_ref(*new PS1FontProgram()); TRY(data.font_program->create(font_file_stream->bytes(), data.encoding, length1, length2));