1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibPDF: Assert compressed xref's 2nd field is non-zero

This commit is contained in:
Matthew Olsson 2023-07-16 14:35:43 -07:00 committed by Jelle Raaijmakers
parent f9c1d11380
commit bfd8faedf9

View file

@ -387,6 +387,8 @@ PDFErrorOr<NonnullRefPtr<XRefTable>> DocumentParser::parse_xref_stream()
auto field_sizes = TRY(dict->get_array(m_document, "W"));
if (field_sizes->size() != 3)
return error("Malformed xref dictionary");
if (field_sizes->at(1).get_u32() == 0)
return error("Malformed xref dictionary");
auto highest_object_number = dict->get_value("Size").get<int>() - 1;