Commit 428d96dfe19da96ac4759b190f5b25cf75ecdac6

Authored by Jay Berkenbilt
1 parent a4fd4b91

Convert many more errors to warnings

examples/qtest/bookmarks.test
@@ -29,8 +29,8 @@ $td->runtest("no bookmarks", @@ -29,8 +29,8 @@ $td->runtest("no bookmarks",
29 29
30 $td->runtest("bad", 30 $td->runtest("bad",
31 {$td->COMMAND => "pdf-bookmarks 3.pdf"}, 31 {$td->COMMAND => "pdf-bookmarks 3.pdf"},
32 - {$td->STRING => "pdf-bookmarks processing file 3.pdf: " .  
33 - "3.pdf: not a PDF file\n", 32 + {$td->REGEXP => "pdf-bookmarks processing file 3.pdf: " .
  33 + ".*unable to find trailer.*",
34 $td->EXIT_STATUS => 2}, 34 $td->EXIT_STATUS => 2},
35 $td->NORMALIZE_NEWLINES); 35 $td->NORMALIZE_NEWLINES);
36 36
examples/qtest/npages.test
@@ -16,7 +16,7 @@ $td->runtest("normal", @@ -16,7 +16,7 @@ $td->runtest("normal",
16 16
17 $td->runtest("error", 17 $td->runtest("error",
18 {$td->COMMAND => "pdf-npages bad"}, 18 {$td->COMMAND => "pdf-npages bad"},
19 - {$td->STRING => "pdf-npages: bad: not a PDF file\n", 19 + {$td->REGEXP => "pdf-npages: bad: unable to find trailer.*",
20 $td->EXIT_STATUS => 2}, 20 $td->EXIT_STATUS => 2},
21 $td->NORMALIZE_NEWLINES); 21 $td->NORMALIZE_NEWLINES);
22 22
libqpdf/QPDF.cc
@@ -205,7 +205,7 @@ QPDF::getWarnings() @@ -205,7 +205,7 @@ QPDF::getWarnings()
205 void 205 void
206 QPDF::parse(char const* password) 206 QPDF::parse(char const* password)
207 { 207 {
208 - PCRE header_re("\\A((?s).*?)%PDF-(1.\d+)\b"); 208 + PCRE header_re("\\A((?s).*?)%PDF-(\\d+.\d+)\b");
209 PCRE eof_re("(?s:startxref\\s+(\\d+)\\s+%%EOF\\b)"); 209 PCRE eof_re("(?s:startxref\\s+(\\d+)\\s+%%EOF\\b)");
210 210
211 if (password) 211 if (password)
@@ -233,16 +233,17 @@ QPDF::parse(char const* password) @@ -233,16 +233,17 @@ QPDF::parse(char const* password)
233 this->file = new OffsetInputSource(this->file, global_offset); 233 this->file = new OffsetInputSource(this->file, global_offset);
234 } 234 }
235 this->pdf_version = m1.getMatch(2); 235 this->pdf_version = m1.getMatch(2);
236 - if (atof(this->pdf_version.c_str()) < 1.2)  
237 - {  
238 - this->tokenizer.allowPoundAnywhereInName();  
239 - }  
240 } 236 }
241 else 237 else
242 { 238 {
243 QTC::TC("qpdf", "QPDF not a pdf file"); 239 QTC::TC("qpdf", "QPDF not a pdf file");
244 - throw QPDFExc(qpdf_e_damaged_pdf, this->file->getName(),  
245 - "", 0, "not a PDF file"); 240 + warn(QPDFExc(qpdf_e_damaged_pdf, this->file->getName(),
  241 + "", 0, "can't find PDF header"));
  242 + this->pdf_version = "1.0";
  243 + }
  244 + if (atof(this->pdf_version.c_str()) < 1.2)
  245 + {
  246 + this->tokenizer.allowPoundAnywhereInName();
246 } 247 }
247 248
248 // PDF spec says %%EOF must be found within the last 1024 bytes of 249 // PDF spec says %%EOF must be found within the last 1024 bytes of
@@ -1152,7 +1153,7 @@ QPDF::readObject(PointerHolder&lt;InputSource&gt; input, @@ -1152,7 +1153,7 @@ QPDF::readObject(PointerHolder&lt;InputSource&gt; input,
1152 { 1153 {
1153 if (this->attempt_recovery) 1154 if (this->attempt_recovery)
1154 { 1155 {
1155 - // may throw an exception 1156 + warn(e);
1156 length = recoverStreamLength( 1157 length = recoverStreamLength(
1157 input, objid, generation, stream_offset); 1158 input, objid, generation, stream_offset);
1158 } 1159 }
@@ -1288,9 +1289,9 @@ QPDF::recoverStreamLength(PointerHolder&lt;InputSource&gt; input, @@ -1288,9 +1289,9 @@ QPDF::recoverStreamLength(PointerHolder&lt;InputSource&gt; input,
1288 1289
1289 if (length == 0) 1290 if (length == 0)
1290 { 1291 {
1291 - throw QPDFExc(qpdf_e_damaged_pdf, input->getName(),  
1292 - this->last_object_description, stream_offset,  
1293 - "unable to recover stream data"); 1292 + warn(QPDFExc(qpdf_e_damaged_pdf, input->getName(),
  1293 + this->last_object_description, stream_offset,
  1294 + "unable to recover stream data; treating stream as empty"));
1294 } 1295 }
1295 1296
1296 QTC::TC("qpdf", "QPDF recovered stream length"); 1297 QTC::TC("qpdf", "QPDF recovered stream length");
@@ -1309,6 +1310,10 @@ QPDF::readObjectAtOffset(bool try_recovery, @@ -1309,6 +1310,10 @@ QPDF::readObjectAtOffset(bool try_recovery,
1309 int exp_objid, int exp_generation, 1310 int exp_objid, int exp_generation,
1310 int& objid, int& generation) 1311 int& objid, int& generation)
1311 { 1312 {
  1313 + if (! this->attempt_recovery)
  1314 + {
  1315 + try_recovery = false;
  1316 + }
1312 setLastObjectDescription(description, exp_objid, exp_generation); 1317 setLastObjectDescription(description, exp_objid, exp_generation);
1313 1318
1314 // Special case: if offset is 0, just return null. Some PDF 1319 // Special case: if offset is 0, just return null. Some PDF
@@ -1363,16 +1368,27 @@ QPDF::readObjectAtOffset(bool try_recovery, @@ -1363,16 +1368,27 @@ QPDF::readObjectAtOffset(bool try_recovery,
1363 (! ((objid == exp_objid) && (generation == exp_generation)))) 1368 (! ((objid == exp_objid) && (generation == exp_generation))))
1364 { 1369 {
1365 QTC::TC("qpdf", "QPDF err wrong objid/generation"); 1370 QTC::TC("qpdf", "QPDF err wrong objid/generation");
1366 - throw QPDFExc(qpdf_e_damaged_pdf, this->file->getName(),  
1367 - this->last_object_description, offset,  
1368 - std::string("expected ") +  
1369 - QUtil::int_to_string(exp_objid) + " " +  
1370 - QUtil::int_to_string(exp_generation) + " obj"); 1371 + QPDFExc e(qpdf_e_damaged_pdf, this->file->getName(),
  1372 + this->last_object_description, offset,
  1373 + std::string("expected ") +
  1374 + QUtil::int_to_string(exp_objid) + " " +
  1375 + QUtil::int_to_string(exp_generation) + " obj");
  1376 + if (try_recovery)
  1377 + {
  1378 + // Will be retried below
  1379 + throw e;
  1380 + }
  1381 + else
  1382 + {
  1383 + // We can try reading the object anyway even if the ID
  1384 + // doesn't match.
  1385 + warn(e);
  1386 + }
1371 } 1387 }
1372 } 1388 }
1373 catch (QPDFExc& e) 1389 catch (QPDFExc& e)
1374 { 1390 {
1375 - if ((exp_objid >= 0) && try_recovery && this->attempt_recovery) 1391 + if ((exp_objid >= 0) && try_recovery)
1376 { 1392 {
1377 // Try again after reconstructing xref table 1393 // Try again after reconstructing xref table
1378 reconstruct_xref(e); 1394 reconstruct_xref(e);
@@ -1496,31 +1512,42 @@ QPDF::resolve(int objid, int generation) @@ -1496,31 +1512,42 @@ QPDF::resolve(int objid, int generation)
1496 } 1512 }
1497 1513
1498 QPDFXRefEntry const& entry = this->xref_table[og]; 1514 QPDFXRefEntry const& entry = this->xref_table[og];
1499 - switch (entry.getType())  
1500 - {  
1501 - case 1:  
1502 - {  
1503 - qpdf_offset_t offset = entry.getOffset();  
1504 - // Object stored in cache by readObjectAtOffset  
1505 - int aobjid;  
1506 - int ageneration;  
1507 - QPDFObjectHandle oh =  
1508 - readObjectAtOffset(true, offset, "", objid, generation,  
1509 - aobjid, ageneration);  
1510 - }  
1511 - break; 1515 + try
  1516 + {
  1517 + switch (entry.getType())
  1518 + {
  1519 + case 1:
  1520 + {
  1521 + qpdf_offset_t offset = entry.getOffset();
  1522 + // Object stored in cache by readObjectAtOffset
  1523 + int aobjid;
  1524 + int ageneration;
  1525 + QPDFObjectHandle oh =
  1526 + readObjectAtOffset(true, offset, "", objid, generation,
  1527 + aobjid, ageneration);
  1528 + }
  1529 + break;
1512 1530
1513 - case 2:  
1514 - resolveObjectsInStream(entry.getObjStreamNumber());  
1515 - break; 1531 + case 2:
  1532 + resolveObjectsInStream(entry.getObjStreamNumber());
  1533 + break;
1516 1534
1517 - default:  
1518 - throw QPDFExc(qpdf_e_damaged_pdf, this->file->getName(), "", 0,  
1519 - "object " +  
1520 - QUtil::int_to_string(objid) + "/" +  
1521 - QUtil::int_to_string(generation) +  
1522 - " has unexpected xref entry type");  
1523 - } 1535 + default:
  1536 + throw QPDFExc(qpdf_e_damaged_pdf, this->file->getName(), "", 0,
  1537 + "object " +
  1538 + QUtil::int_to_string(objid) + "/" +
  1539 + QUtil::int_to_string(generation) +
  1540 + " has unexpected xref entry type");
  1541 + }
  1542 + }
  1543 + catch (QPDFExc& e)
  1544 + {
  1545 + QTC::TC("qpdf", "QPDF resolve failure to null");
  1546 + warn(e);
  1547 + QPDFObjectHandle oh = QPDFObjectHandle::newNull();
  1548 + this->obj_cache[og] =
  1549 + ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1);
  1550 + }
1524 } 1551 }
1525 1552
1526 return this->obj_cache[og].object; 1553 return this->obj_cache[og].object;
qpdf/qpdf.testcov
@@ -278,3 +278,4 @@ QPDF recursion loop in resolve 0 @@ -278,3 +278,4 @@ QPDF recursion loop in resolve 0
278 QPDFObjectHandle treat word as string 0 278 QPDFObjectHandle treat word as string 0
279 QPDFObjectHandle found fake 1 279 QPDFObjectHandle found fake 1
280 QPDFObjectHandle no val for last key 0 280 QPDFObjectHandle no val for last key 0
  281 +QPDF resolve failure to null 0
qpdf/qtest/qpdf.test
@@ -220,7 +220,7 @@ $td-&gt;runtest(&quot;C API: qpdf version&quot;, @@ -220,7 +220,7 @@ $td-&gt;runtest(&quot;C API: qpdf version&quot;,
220 220
221 # Files to reproduce various bugs 221 # Files to reproduce various bugs
222 foreach my $d ( 222 foreach my $d (
223 - ["51", "resolve loop", 2], 223 + ["51", "resolve loop", 3],
224 ["99", "object 0", 2], 224 ["99", "object 0", 2],
225 ["99b", "object 0", 2], 225 ["99b", "object 0", 2],
226 ["100", "xref reconstruction loop", 2], 226 ["100", "xref reconstruction loop", 2],
@@ -228,7 +228,7 @@ foreach my $d ( @@ -228,7 +228,7 @@ foreach my $d (
228 ["117", "other infinite loop", 2], 228 ["117", "other infinite loop", 2],
229 ["118", "other infinite loop", 2], 229 ["118", "other infinite loop", 2],
230 ["119", "other infinite loop", 3], 230 ["119", "other infinite loop", 3],
231 - ["120", "other infinite loop", 2], 231 + ["120", "other infinite loop", 3],
232 ) 232 )
233 { 233 {
234 my ($n, $description, $exit_status) = @$d; 234 my ($n, $description, $exit_status) = @$d;
@@ -464,7 +464,7 @@ $td-&gt;runtest(&quot;EOF terminating literal tokens&quot;, @@ -464,7 +464,7 @@ $td-&gt;runtest(&quot;EOF terminating literal tokens&quot;,
464 $td->NORMALIZE_NEWLINES); 464 $td->NORMALIZE_NEWLINES);
465 $td->runtest("EOF reading token", 465 $td->runtest("EOF reading token",
466 {$td->COMMAND => "qpdf --check eof-reading-token.pdf"}, 466 {$td->COMMAND => "qpdf --check eof-reading-token.pdf"},
467 - {$td->FILE => "eof-reading-token.out", $td->EXIT_STATUS => 2}, 467 + {$td->FILE => "eof-reading-token.out", $td->EXIT_STATUS => 3},
468 $td->NORMALIZE_NEWLINES); 468 $td->NORMALIZE_NEWLINES);
469 $td->runtest("extra header text", 469 $td->runtest("extra header text",
470 {$td->COMMAND => "test_driver 32 minimal.pdf"}, 470 {$td->COMMAND => "test_driver 32 minimal.pdf"},
@@ -794,9 +794,12 @@ $n_tests += @badfiles + 3; @@ -794,9 +794,12 @@ $n_tests += @badfiles + 3;
794 # neither Acrobat nor other PDF viewers really care. Tests 12 and 28 794 # neither Acrobat nor other PDF viewers really care. Tests 12 and 28
795 # have error conditions that used to be fatal but are now considered 795 # have error conditions that used to be fatal but are now considered
796 # non-fatal. 796 # non-fatal.
797 -my %badtest_overrides = (6 => 0, 12 => 0, 13 => 0,  
798 - 14 => 0, 15 => 0, 17 => 0,  
799 - 28 => 0, 30 => 0, 31 => 0, 36 => 0); 797 +my %badtest_overrides = ();
  798 +for(6, 12..15, 17, 22..28, 30..32, 34, 36)
  799 +{
  800 + $badtest_overrides{$_} = 0;
  801 +}
  802 +
800 for (my $i = 1; $i <= scalar(@badfiles); ++$i) 803 for (my $i = 1; $i <= scalar(@badfiles); ++$i)
801 { 804 {
802 my $status = $badtest_overrides{$i}; 805 my $status = $badtest_overrides{$i};
@@ -835,7 +838,7 @@ $n_tests += @badfiles + 8; @@ -835,7 +838,7 @@ $n_tests += @badfiles + 8;
835 # though in some cases it may. Acrobat Reader would not be able to 838 # though in some cases it may. Acrobat Reader would not be able to
836 # recover any of these files any better. 839 # recover any of these files any better.
837 my %recover_failures = (); 840 my %recover_failures = ();
838 -for (1, 7, 16, 18..21, 24, 29, 35) 841 +for (1, 7, 16, 18..21, 29, 35)
839 { 842 {
840 $recover_failures{$_} = 1; 843 $recover_failures{$_} = 1;
841 } 844 }
qpdf/qtest/qpdf/bad1-recover.out
1 -bad1.pdf: not a PDF file 1 +WARNING: bad1.pdf: can't find PDF header
  2 +WARNING: bad1.pdf: file is damaged
  3 +WARNING: bad1.pdf: can't find startxref
  4 +WARNING: bad1.pdf: Attempting to reconstruct cross-reference table
  5 +bad1.pdf: unable to find trailer dictionary while recovering damaged file
qpdf/qtest/qpdf/bad1.out
1 -bad1.pdf: not a PDF file 1 +WARNING: bad1.pdf: can't find PDF header
  2 +bad1.pdf: can't find startxref
qpdf/qtest/qpdf/bad22-recover.out
  1 +WARNING: bad22.pdf (object 4 0, file position 314): stream dictionary lacks /Length key
1 WARNING: bad22.pdf (object 4 0, file position 341): attempting to recover stream length 2 WARNING: bad22.pdf (object 4 0, file position 341): attempting to recover stream length
2 /QTest is indirect and has type stream (10) 3 /QTest is indirect and has type stream (10)
3 /QTest is a stream. Dictionary: << /Qength 44 >> 4 /QTest is a stream. Dictionary: << /Qength 44 >>
qpdf/qtest/qpdf/bad22.out
1 -bad22.pdf (object 4 0, file position 314): stream dictionary lacks /Length key 1 +WARNING: bad22.pdf (object 4 0, file position 314): stream dictionary lacks /Length key
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad23-recover.out
  1 +WARNING: bad23.pdf (object 4 0, file position 314): /Length key in stream dictionary is not an integer
1 WARNING: bad23.pdf (object 4 0, file position 341): attempting to recover stream length 2 WARNING: bad23.pdf (object 4 0, file position 341): attempting to recover stream length
2 /QTest is indirect and has type stream (10) 3 /QTest is indirect and has type stream (10)
3 /QTest is a stream. Dictionary: << /Length () >> 4 /QTest is a stream. Dictionary: << /Length () >>
qpdf/qtest/qpdf/bad23.out
1 -bad23.pdf (object 4 0, file position 314): /Length key in stream dictionary is not an integer 1 +WARNING: bad23.pdf (object 4 0, file position 314): /Length key in stream dictionary is not an integer
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad24-recover.out
  1 +WARNING: bad24.pdf (object 4 0, file position 385): expected endstream
1 WARNING: bad24.pdf (object 4 0, file position 341): attempting to recover stream length 2 WARNING: bad24.pdf (object 4 0, file position 341): attempting to recover stream length
2 -bad24.pdf (object 4 0, file position 341): unable to recover stream data 3 +WARNING: bad24.pdf (object 4 0, file position 341): unable to recover stream data; treating stream as empty
  4 +WARNING: bad24.pdf (object 4 0, file position 778): EOF while reading token
  5 +/QTest is implicit
  6 +/QTest is indirect and has type null (2)
  7 +/QTest is null
  8 +unparse: 4 0 R
  9 +unparseResolved: null
  10 +test 1 done
qpdf/qtest/qpdf/bad24.out
1 -bad24.pdf (object 4 0, file position 385): expected endstream 1 +WARNING: bad24.pdf (object 4 0, file position 385): expected endstream
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad25.out
1 -bad25.pdf (object 4 0, file position 307): expected n n obj 1 +WARNING: bad25.pdf (object 4 0, file position 307): expected n n obj
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad26.out
1 -bad26.pdf (object 4 0, file position 307): expected n n obj 1 +WARNING: bad26.pdf (object 4 0, file position 307): expected n n obj
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad27.out
1 -bad27.pdf (object 4 0, file position 307): expected n n obj 1 +WARNING: bad27.pdf (object 4 0, file position 307): expected n n obj
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad32.out
1 -bad32.pdf (object 4 0, file position 307): expected 4 0 obj 1 +WARNING: bad32.pdf (object 4 0, file position 307): expected 4 0 obj
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad34.out
1 -bad34.pdf (object 4 0, file position 322): expected n n obj 1 +WARNING: bad34.pdf (object 4 0, file position 322): expected n n obj
  2 +/QTest is implicit
  3 +/QTest is indirect and has type null (2)
  4 +/QTest is null
  5 +unparse: 4 0 R
  6 +unparseResolved: null
  7 +test 0 done
qpdf/qtest/qpdf/bad35-recover.out
1 -bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type 1 +WARNING: bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type
  2 +operation for Dictionary object attempted on object of wrong type
qpdf/qtest/qpdf/bad35.out
1 -bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type 1 +WARNING: bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type
  2 +operation for Dictionary object attempted on object of wrong type
qpdf/qtest/qpdf/c-read-errors.out
1 -error: bad1.pdf: not a PDF file 1 +warning: bad1.pdf: can't find PDF header
2 code: 5 2 code: 5
3 file: bad1.pdf 3 file: bad1.pdf
4 pos : 0 4 pos : 0
5 - text: not a PDF file 5 + text: can't find PDF header
  6 +warning: bad1.pdf: file is damaged
  7 + code: 5
  8 + file: bad1.pdf
  9 + pos : 0
  10 + text: file is damaged
  11 +warning: bad1.pdf: can't find startxref
  12 + code: 5
  13 + file: bad1.pdf
  14 + pos : 0
  15 + text: can't find startxref
  16 +warning: bad1.pdf: Attempting to reconstruct cross-reference table
  17 + code: 5
  18 + file: bad1.pdf
  19 + pos : 0
  20 + text: Attempting to reconstruct cross-reference table
  21 +error: bad1.pdf: unable to find trailer dictionary while recovering damaged file
  22 + code: 5
  23 + file: bad1.pdf
  24 + pos : 0
  25 + text: unable to find trailer dictionary while recovering damaged file
qpdf/qtest/qpdf/eof-reading-token.out
@@ -2,4 +2,4 @@ checking eof-reading-token.pdf @@ -2,4 +2,4 @@ checking eof-reading-token.pdf
2 PDF Version: 1.3 2 PDF Version: 1.3
3 File is not encrypted 3 File is not encrypted
4 File is not linearized 4 File is not linearized
5 -object stream 12 (file position 5): EOF while reading token 5 +WARNING: object stream 12 (file position 5): EOF while reading token
qpdf/qtest/qpdf/heifer.out
1 WARNING: heifer.pdf: file is damaged 1 WARNING: heifer.pdf: file is damaged
2 WARNING: heifer.pdf (file position 92741): xref not found 2 WARNING: heifer.pdf (file position 92741): xref not found
3 WARNING: heifer.pdf: Attempting to reconstruct cross-reference table 3 WARNING: heifer.pdf: Attempting to reconstruct cross-reference table
  4 +WARNING: heifer.pdf (object 2 0, file position 2165): expected endstream
4 WARNING: heifer.pdf (object 2 0, file position 51): attempting to recover stream length 5 WARNING: heifer.pdf (object 2 0, file position 51): attempting to recover stream length
5 qpdf: operation succeeded with warnings; resulting file may have some problems 6 qpdf: operation succeeded with warnings; resulting file may have some problems
qpdf/qtest/qpdf/issue-100.out
@@ -7,6 +7,8 @@ WARNING: issue-100.pdf (file position 289): unknown token while reading object; @@ -7,6 +7,8 @@ WARNING: issue-100.pdf (file position 289): unknown token while reading object;
7 WARNING: issue-100.pdf (file position 294): unknown token while reading object; treating as string 7 WARNING: issue-100.pdf (file position 294): unknown token while reading object; treating as string
8 WARNING: issue-100.pdf (file position 297): unknown token while reading object; treating as string 8 WARNING: issue-100.pdf (file position 297): unknown token while reading object; treating as string
9 WARNING: issue-100.pdf (file position 304): unknown token while reading object; treating as string 9 WARNING: issue-100.pdf (file position 304): unknown token while reading object; treating as string
  10 +WARNING: issue-100.pdf (file position 308): unexpected )
  11 +WARNING: issue-100.pdf (object 5 0, file position 418): /Length key in stream dictionary is not an integer
10 WARNING: issue-100.pdf (object 5 0, file position 489): attempting to recover stream length 12 WARNING: issue-100.pdf (object 5 0, file position 489): attempting to recover stream length
11 WARNING: issue-100.pdf (trailer, file position 953): expected dictionary key but found non-name object; inserting key /QPDFFake1 13 WARNING: issue-100.pdf (trailer, file position 953): expected dictionary key but found non-name object; inserting key /QPDFFake1
12 WARNING: issue-100.pdf (trailer, file position 953): dictionary ended prematurely; using null as value for last key 14 WARNING: issue-100.pdf (trailer, file position 953): dictionary ended prematurely; using null as value for last key
qpdf/qtest/qpdf/issue-101.out
@@ -3,15 +3,22 @@ WARNING: issue-101.pdf (file position 3526): xref not found @@ -3,15 +3,22 @@ WARNING: issue-101.pdf (file position 3526): xref not found
3 WARNING: issue-101.pdf: Attempting to reconstruct cross-reference table 3 WARNING: issue-101.pdf: Attempting to reconstruct cross-reference table
4 WARNING: issue-101.pdf (file position 1242): expected dictionary key but found non-name object; inserting key /QPDFFake1 4 WARNING: issue-101.pdf (file position 1242): expected dictionary key but found non-name object; inserting key /QPDFFake1
5 WARNING: issue-101.pdf (file position 1242): dictionary ended prematurely; using null as value for last key 5 WARNING: issue-101.pdf (file position 1242): dictionary ended prematurely; using null as value for last key
  6 +WARNING: issue-101.pdf (object 5 0, file position 1438): /Length key in stream dictionary is not an integer
6 WARNING: issue-101.pdf (object 5 0, file position 1509): attempting to recover stream length 7 WARNING: issue-101.pdf (object 5 0, file position 1509): attempting to recover stream length
  8 +WARNING: issue-101.pdf (trailer, file position 2026): /Length key in stream dictionary is not an integer
7 WARNING: issue-101.pdf (trailer, file position 2097): attempting to recover stream length 9 WARNING: issue-101.pdf (trailer, file position 2097): attempting to recover stream length
8 WARNING: issue-101.pdf (trailer, file position 2928): unknown token while reading object; treating as string 10 WARNING: issue-101.pdf (trailer, file position 2928): unknown token while reading object; treating as string
9 WARNING: issue-101.pdf (trailer, file position 2930): unknown token while reading object; treating as string 11 WARNING: issue-101.pdf (trailer, file position 2930): unknown token while reading object; treating as string
10 WARNING: issue-101.pdf (trailer, file position 2928): expected dictionary key but found non-name object; inserting key /QPDFFake1 12 WARNING: issue-101.pdf (trailer, file position 2928): expected dictionary key but found non-name object; inserting key /QPDFFake1
11 WARNING: issue-101.pdf (trailer, file position 2928): expected dictionary key but found non-name object; inserting key /QPDFFake2 13 WARNING: issue-101.pdf (trailer, file position 2928): expected dictionary key but found non-name object; inserting key /QPDFFake2
12 WARNING: issue-101.pdf (trailer, file position 2928): expected dictionary key but found non-name object; inserting key /QPDFFake3 14 WARNING: issue-101.pdf (trailer, file position 2928): expected dictionary key but found non-name object; inserting key /QPDFFake3
  15 +WARNING: issue-101.pdf (trailer, file position 2925): /Length key in stream dictionary is not an integer
13 WARNING: issue-101.pdf (trailer, file position 2996): attempting to recover stream length 16 WARNING: issue-101.pdf (trailer, file position 2996): attempting to recover stream length
  17 +WARNING: issue-101.pdf (trailer, file position 3339): /Length key in stream dictionary is not an integer
14 WARNING: issue-101.pdf (trailer, file position 3410): attempting to recover stream length 18 WARNING: issue-101.pdf (trailer, file position 3410): attempting to recover stream length
  19 +WARNING: issue-101.pdf (trailer, file position 3560): /Length key in stream dictionary is not an integer
15 WARNING: issue-101.pdf (trailer, file position 3631): attempting to recover stream length 20 WARNING: issue-101.pdf (trailer, file position 3631): attempting to recover stream length
  21 +WARNING: issue-101.pdf (trailer, file position 4113): /Length key in stream dictionary is not an integer
16 WARNING: issue-101.pdf (trailer, file position 4184): attempting to recover stream length 22 WARNING: issue-101.pdf (trailer, file position 4184): attempting to recover stream length
17 -issue-101.pdf (trailer, file position 4184): unable to recover stream data 23 +WARNING: issue-101.pdf (trailer, file position 4184): unable to recover stream data; treating stream as empty
  24 +issue-101.pdf: unable to find trailer dictionary while recovering damaged file
qpdf/qtest/qpdf/issue-117.out
@@ -2,5 +2,6 @@ WARNING: issue-117.pdf: file is damaged @@ -2,5 +2,6 @@ WARNING: issue-117.pdf: file is damaged
2 WARNING: issue-117.pdf: can't find startxref 2 WARNING: issue-117.pdf: can't find startxref
3 WARNING: issue-117.pdf: Attempting to reconstruct cross-reference table 3 WARNING: issue-117.pdf: Attempting to reconstruct cross-reference table
4 WARNING: issue-117.pdf (file position 66): loop detected resolving object 2 0 4 WARNING: issue-117.pdf (file position 66): loop detected resolving object 2 0
  5 +WARNING: issue-117.pdf (object 2 0, file position 22): /Length key in stream dictionary is not an integer
5 WARNING: issue-117.pdf (object 2 0, file position 67): attempting to recover stream length 6 WARNING: issue-117.pdf (object 2 0, file position 67): attempting to recover stream length
6 attempt to make a stream into a direct object 7 attempt to make a stream into a direct object
qpdf/qtest/qpdf/issue-118.out
1 WARNING: issue-118.pdf (file position 732): loop detected resolving object 2 0 1 WARNING: issue-118.pdf (file position 732): loop detected resolving object 2 0
2 -issue-118.pdf (xref stream: object 8 0, file position 732): supposed object stream 2 is not a stream 2 +WARNING: issue-118.pdf (xref stream: object 8 0, file position 732): supposed object stream 2 is not a stream
  3 +operation for Dictionary object attempted on object of wrong type
qpdf/qtest/qpdf/issue-120.out
1 WARNING: issue-120.pdf (file position 85): loop detected resolving object 3 0 1 WARNING: issue-120.pdf (file position 85): loop detected resolving object 3 0
2 -issue-120.pdf (object 6 0, file position 85): supposed object stream 3 is not a stream 2 +WARNING: issue-120.pdf (object 6 0, file position 85): supposed object stream 3 is not a stream
  3 +qpdf: operation succeeded with warnings; resulting file may have some problems
qpdf/qtest/qpdf/issue-51.out
@@ -2,5 +2,8 @@ WARNING: issue-51.pdf: reported number of objects (0) inconsistent with actual n @@ -2,5 +2,8 @@ WARNING: issue-51.pdf: reported number of objects (0) inconsistent with actual n
2 WARNING: issue-51.pdf (object 7 0, file position 553): expected endobj 2 WARNING: issue-51.pdf (object 7 0, file position 553): expected endobj
3 WARNING: issue-51.pdf (object 1 0, file position 359): expected endobj 3 WARNING: issue-51.pdf (object 1 0, file position 359): expected endobj
4 WARNING: issue-51.pdf (file position 70): loop detected resolving object 2 0 4 WARNING: issue-51.pdf (file position 70): loop detected resolving object 2 0
  5 +WARNING: issue-51.pdf (object 2 0, file position 26): /Length key in stream dictionary is not an integer
5 WARNING: issue-51.pdf (object 2 0, file position 71): attempting to recover stream length 6 WARNING: issue-51.pdf (object 2 0, file position 71): attempting to recover stream length
6 -issue-51.pdf (object 2 0, file position 71): unable to recover stream data 7 +WARNING: issue-51.pdf (object 2 0, file position 71): unable to recover stream data; treating stream as empty
  8 +WARNING: issue-51.pdf (object 2 0, file position 977): EOF while reading token
  9 +qpdf: operation succeeded with warnings; resulting file may have some problems
qpdf/qtest/qpdf/linearization-bounds-1.out
@@ -2,5 +2,6 @@ checking linearization-bounds-1.pdf @@ -2,5 +2,6 @@ checking linearization-bounds-1.pdf
2 PDF Version: 1.3 2 PDF Version: 1.3
3 File is not encrypted 3 File is not encrypted
4 File is linearized 4 File is linearized
  5 +WARNING: linearization-bounds-1.pdf (linearization hint stream: object 62 0, file position 1001182): EOF while reading token
5 WARNING: linearization-bounds-1.pdf (linearization hint stream: object 62 0, file position 1183): attempting to recover stream length 6 WARNING: linearization-bounds-1.pdf (linearization hint stream: object 62 0, file position 1183): attempting to recover stream length
6 linearization-bounds-1.pdf (linearization hint table, file position 1183): /S (shared object) offset is out of bounds 7 linearization-bounds-1.pdf (linearization hint table, file position 1183): /S (shared object) offset is out of bounds
qpdf/qtest/qpdf/linearization-bounds-2.out
@@ -2,5 +2,6 @@ checking linearization-bounds-2.pdf @@ -2,5 +2,6 @@ checking linearization-bounds-2.pdf
2 PDF Version: 1.3 2 PDF Version: 1.3
3 File is not encrypted 3 File is not encrypted
4 File is linearized 4 File is linearized
  5 +WARNING: linearization-bounds-2.pdf (linearization hint stream: object 62 0, file position 1282): expected endstream
5 WARNING: linearization-bounds-2.pdf (linearization hint stream: object 62 0, file position 1183): attempting to recover stream length 6 WARNING: linearization-bounds-2.pdf (linearization hint stream: object 62 0, file position 1183): attempting to recover stream length
6 linearization-bounds-2.pdf (linearization hint table, file position 1183): /S (shared object) offset is out of bounds 7 linearization-bounds-2.pdf (linearization hint table, file position 1183): /S (shared object) offset is out of bounds
qpdf/qtest/qpdf/linearization-large-vector-alloc.out
@@ -2,5 +2,6 @@ checking linearization-large-vector-alloc.pdf @@ -2,5 +2,6 @@ checking linearization-large-vector-alloc.pdf
2 PDF Version: 1.3 2 PDF Version: 1.3
3 File is not encrypted 3 File is not encrypted
4 File is linearized 4 File is linearized
  5 +WARNING: linearization-large-vector-alloc.pdf (linearization hint stream: object 62 0, file position 1282): expected endstream
5 WARNING: linearization-large-vector-alloc.pdf (linearization hint stream: object 62 0, file position 1183): attempting to recover stream length 6 WARNING: linearization-large-vector-alloc.pdf (linearization hint stream: object 62 0, file position 1183): attempting to recover stream length
6 overflow reading bit stream 7 overflow reading bit stream