summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibPDF
diff options
context:
space:
mode:
authorRodrigo Tobar <rtobar@icrar.org>2022-12-16 00:18:50 +0800
committerAndrew Kaster <andrewdkaster@gmail.com>2022-12-16 01:24:43 -0700
commita1af79dca623bc7393aa8458bca1e11ec4d46301 (patch)
tree2ec7cbd501779828c5e2f3454a39d2eddab6464e /Userland/Libraries/LibPDF
parentcb1a7cc7211b21a160a4a2faa1cf3bb0ac30a698 (diff)
downloadserenity-a1af79dca623bc7393aa8458bca1e11ec4d46301.zip
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.
Diffstat (limited to 'Userland/Libraries/LibPDF')
-rw-r--r--Userland/Libraries/LibPDF/Fonts/Type1Font.cpp4
1 files 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::Data> 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<int>();
- auto length2 = font_file_dict->get_value(CommonNames::Length2).get<int>();
+ auto length1 = TRY(document->resolve(font_file_dict->get_value(CommonNames::Length1))).get<int>();
+ auto length2 = TRY(document->resolve(font_file_dict->get_value(CommonNames::Length2))).get<int>();
data.font_program = adopt_ref(*new PS1FontProgram());
TRY(data.font_program->create(font_file_stream->bytes(), data.encoding, length1, length2));