diff --git a/Userland/Libraries/LibPDF/DocumentParser.cpp b/Userland/Libraries/LibPDF/DocumentParser.cpp index a1e9944ef7..b711180358 100644 --- a/Userland/Libraries/LibPDF/DocumentParser.cpp +++ b/Userland/Libraries/LibPDF/DocumentParser.cpp @@ -499,9 +499,12 @@ PDFErrorOr> DocumentParser::parse_xref_table() Vector entries; auto starting_index_value = TRY(parse_number()); - auto starting_index = starting_index_value.get(); auto object_count_value = TRY(parse_number()); + if (!(starting_index_value.has_u32() && object_count_value.has_u32())) + return error("Malformed xref entry"); + auto object_count = object_count_value.get(); + auto starting_index = starting_index_value.get(); for (int i = 0; i < object_count; i++) { auto offset_string = ByteString(m_reader.bytes().slice(m_reader.offset(), 10));