LibPDF: Fix two parser bugs

- A newline was assumed to follow the "stream" keyword, when it can also
  be a windows-style line break
- Fix not consuming the "endobj" at the end of every indirect object
This commit is contained in:
Matthew Olsson 2021-05-26 22:51:10 -07:00 committed by Ali Mohammad Pur
parent ffda24373a
commit be1be47613

View file

@ -316,7 +316,7 @@ Value Parser::parse_value()
auto dict = parse_dict();
if (!dict)
return {};
if (m_reader.matches("stream\n"))
if (m_reader.matches("stream"))
return parse_stream(dict.release_nonnull());
return dict;
}
@ -371,6 +371,9 @@ RefPtr<IndirectValue> Parser::parse_indirect_value(int index, int generation)
if (!m_reader.matches("endobj"))
return {};
consume(6);
consume_whitespace();
return make_object<IndirectValue>(index, generation, value);
}