Commit 6884ad2eadff6795def2dd336a871227bc8c7d7e

Authored by Jay Berkenbilt
1 parent ce435222

Fix logic error in recovery

A stray semicolon caused a condition to be incorrectly applied during
stream length recovery.
libqpdf/QPDF.cc
... ... @@ -1414,7 +1414,7 @@ QPDF::findEndstream()
1414 1414 QPDFTokenizer::Token t = readToken(this->m->file, true);
1415 1415 if ((t.getType() == QPDFTokenizer::tt_word) &&
1416 1416 ((t.getValue() == "endobj") ||
1417   - (t.getValue() == "endstream")));
  1417 + (t.getValue() == "endstream")))
1418 1418 {
1419 1419 this->m->file->seek(this->m->file->getLastOffset(), SEEK_SET);
1420 1420 return true;
... ...
qpdf/qtest/qpdf/issue-101.out
... ... @@ -11,7 +11,7 @@ WARNING: issue-101.pdf (trailer, file position 1702): attempting to recover stre
11 11 WARNING: issue-101.pdf (trailer, file position 1702): recovered stream length: 12
12 12 WARNING: issue-101.pdf (trailer, file position 2026): /Length key in stream dictionary is not an integer
13 13 WARNING: issue-101.pdf (trailer, file position 2097): attempting to recover stream length
14   -WARNING: issue-101.pdf (trailer, file position 2097): recovered stream length: 12
  14 +WARNING: issue-101.pdf (trailer, file position 2097): recovered stream length: 257
15 15 WARNING: issue-101.pdf (trailer, file position 2613): /Length key in stream dictionary is not an integer
16 16 WARNING: issue-101.pdf (trailer, file position 2684): attempting to recover stream length
17 17 WARNING: issue-101.pdf (trailer, file position 2684): recovered stream length: 74
... ...
qpdf/qtest/qpdf/issue-143.out
... ... @@ -3,7 +3,6 @@ WARNING: issue-143.pdf (xref stream: object 3 0, file position 654): stream keyw
3 3 WARNING: issue-143.pdf (xref stream: object 3 0, file position 607): stream dictionary lacks /Length key
4 4 WARNING: issue-143.pdf (xref stream: object 3 0, file position 654): attempting to recover stream length
5 5 WARNING: issue-143.pdf (xref stream: object 3 0, file position 654): recovered stream length: 36
6   -WARNING: issue-143.pdf (xref stream: object 3 0, file position 694): expected endobj
7 6 WARNING: issue-143.pdf: file is damaged
8 7 WARNING: issue-143.pdf (object 1 0, file position 48): expected n n obj
9 8 WARNING: issue-143.pdf: Attempting to reconstruct cross-reference table
... ... @@ -14,6 +13,5 @@ WARNING: issue-143.pdf (file position 24): expected dictionary key but found non
14 13 WARNING: issue-143.pdf (object 1 0, file position 21): stream dictionary lacks /Length key
15 14 WARNING: issue-143.pdf (object 1 0, file position 84): attempting to recover stream length
16 15 WARNING: issue-143.pdf (object 1 0, file position 84): recovered stream length: 606
17   -WARNING: issue-143.pdf (object 1 0, file position 694): expected endobj
18 16 WARNING: object stream 1 (file position 33): expected dictionary key but found non-name object; inserting key /QPDFFake1
19 17 qpdf: operation succeeded with warnings; resulting file may have some problems
... ...
qpdf/qtest/qpdf/issue-143.pdf
No preview for this file type