LibPDF: Allow newlines between xref table and "trailer" keyword

This commit is contained in:
Matthew Olsson 2022-03-06 14:30:38 -07:00 committed by Andreas Kling
parent 4d509ff365
commit 6133acb8c0
Notes: sideshowbarker 2024-07-17 17:50:29 +09:00

View file

@ -303,7 +303,7 @@ PDFErrorOr<NonnullRefPtr<XRefTable>> Parser::parse_xref_table()
auto table = adopt_ref(*new XRefTable());
while (true) {
do {
if (m_reader.matches("trailer"))
return table;
@ -349,11 +349,16 @@ PDFErrorOr<NonnullRefPtr<XRefTable>> Parser::parse_xref_table()
}
table->add_section({ starting_index, object_count, entries });
}
} while (matches_number());
return table;
}
PDFErrorOr<NonnullRefPtr<DictObject>> Parser::parse_file_trailer()
{
while (matches_eol())
consume_eol();
if (!m_reader.matches("trailer"))
return error("Expected \"trailer\" keyword");
m_reader.move_by(7);