mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibPDF: Do not crash when linearized length is incorrect
This is a perfectly valid situation, and in this case we should just parse a standard non-linearized xref table.
This commit is contained in:
parent
e5a6c268ca
commit
f9c1d11380
1 changed files with 3 additions and 9 deletions
|
@ -43,16 +43,10 @@ PDFErrorOr<Version> DocumentParser::initialize()
|
|||
|
||||
bool is_linearized = m_linearization_dictionary.has_value();
|
||||
if (is_linearized) {
|
||||
// The file may have been linearized at one point, but could have been updated afterwards,
|
||||
// which means it is no longer a linearized PDF file.
|
||||
// If the length given in the linearization dictionary is not equal to the length
|
||||
// of the document, then this file has most likely been incrementally updated, and
|
||||
// should no longer be treated as linearized.
|
||||
is_linearized = m_linearization_dictionary.value().length_of_file == m_reader.bytes().size();
|
||||
|
||||
if (!is_linearized) {
|
||||
// FIXME: The file shouldn't be treated as linearized, yet the xref tables are still
|
||||
// split. This might take some tweaking to ensure correct behavior, which can be
|
||||
// implemented later.
|
||||
TODO();
|
||||
}
|
||||
}
|
||||
|
||||
if (is_linearized)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue