mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Add additional sanity check during xref reconstruction
Check that xref table is not empty after recovery. Empty xref tables disable other sanity checks.
This commit is contained in:
parent
7445e0ac1e
commit
2e378d920d
@ -641,6 +641,11 @@ QPDF::reconstruct_xref(QPDFExc& e)
|
|||||||
|
|
||||||
throw damagedPDF("", 0, "unable to find trailer dictionary while recovering damaged file");
|
throw damagedPDF("", 0, "unable to find trailer dictionary while recovering damaged file");
|
||||||
}
|
}
|
||||||
|
if (m->xref_table.empty()) {
|
||||||
|
// We cannot check for an empty xref table in parse because empty tables are valid when
|
||||||
|
// creating QPDF objects from JSON.
|
||||||
|
throw damagedPDF("", 0, "unable to find objects while recovering damaged file");
|
||||||
|
}
|
||||||
|
|
||||||
// We could iterate through the objects looking for streams and try to find objects inside of
|
// We could iterate through the objects looking for streams and try to find objects inside of
|
||||||
// them, but it's probably not worth the trouble. Acrobat can't recover files with any errors
|
// them, but it's probably not worth the trouble. Acrobat can't recover files with any errors
|
||||||
|
@ -4,4 +4,4 @@ WARNING: issue-147.pdf: can't find startxref
|
|||||||
WARNING: issue-147.pdf: Attempting to reconstruct cross-reference table
|
WARNING: issue-147.pdf: Attempting to reconstruct cross-reference table
|
||||||
WARNING: issue-147.pdf (trailer, offset 9): expected dictionary key but found non-name object; inserting key /QPDFFake1
|
WARNING: issue-147.pdf (trailer, offset 9): expected dictionary key but found non-name object; inserting key /QPDFFake1
|
||||||
WARNING: issue-147.pdf: ignoring object with impossibly large id 62
|
WARNING: issue-147.pdf: ignoring object with impossibly large id 62
|
||||||
qpdf: issue-147.pdf: unable to find /Root dictionary
|
qpdf: issue-147.pdf: unable to find objects while recovering damaged file
|
||||||
|
Loading…
Reference in New Issue
Block a user