1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:47:45 +00:00

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

View file

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