Commit ac2b3b96e163c6ef98b708c6392a7e51538dd1cf

Authored by Jay Berkenbilt
1 parent af557db4

Make wrong object stream type a warning

libqpdf/QPDF.cc
... ... @@ -2187,12 +2187,12 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
2187 2187 dict.getKey("/Type").getName() == "/ObjStm"))
2188 2188 {
2189 2189 QTC::TC("qpdf", "QPDF ERR object stream with wrong type");
2190   - throw QPDFExc(qpdf_e_damaged_pdf, this->m->file->getName(),
2191   - this->m->last_object_description,
2192   - this->m->file->getLastOffset(),
2193   - "supposed object stream " +
2194   - QUtil::int_to_string(obj_stream_number) +
2195   - " has wrong type");
  2190 + warn(QPDFExc(qpdf_e_damaged_pdf, this->m->file->getName(),
  2191 + this->m->last_object_description,
  2192 + this->m->file->getLastOffset(),
  2193 + "supposed object stream " +
  2194 + QUtil::int_to_string(obj_stream_number) +
  2195 + " has wrong type"));
2196 2196 }
2197 2197  
2198 2198 if (! (dict.getKey("/N").isInteger() &&
... ...
qpdf/qtest/qpdf.test
... ... @@ -2655,7 +2655,7 @@ $n_tests += @badfiles + 7;
2655 2655 # have error conditions that used to be fatal but are now considered
2656 2656 # non-fatal.
2657 2657 my %badtest_overrides = ();
2658   -for(6, 12..15, 17, 18..32, 34, 36..37)
  2658 +for(6, 12..15, 17, 18..32, 34..37)
2659 2659 {
2660 2660 $badtest_overrides{$_} = 0;
2661 2661 }
... ... @@ -2715,7 +2715,7 @@ $n_tests += @badfiles + 9;
2715 2715 # though in some cases it may. Acrobat Reader would not be able to
2716 2716 # recover any of these files any better.
2717 2717 my %recover_failures = ();
2718   -for (1, 7, 16, 35)
  2718 +for (1, 7, 16)
2719 2719 {
2720 2720 $recover_failures{$_} = 1;
2721 2721 }
... ...
qpdf/qtest/qpdf/bad35-recover.out
1 1 WARNING: bad35.pdf (object 1 0, offset 521): supposed object stream 1 has wrong type
2   -bad35.pdf (offset 521): unable to find /Root dictionary
  2 +/QTest is indirect and has type dictionary (9)
  3 +/QTest is a dictionary
  4 + /Contents is indirect
  5 + /MediaBox is direct
  6 + /Parent is indirect
  7 + /Resources is direct
  8 + /Type is direct
  9 +unparse: 4 0 R
  10 +unparseResolved: << /Contents 7 0 R /MediaBox [ 0 0 612 792 ] /Parent 3 0 R /Resources << /Font << /F1 6 0 R >> /ProcSet 5 0 R >> /Type /Page >>
  11 +test 1 done
... ...
qpdf/qtest/qpdf/bad35.out
1 1 WARNING: bad35.pdf (object 1 0, offset 521): supposed object stream 1 has wrong type
2   -bad35.pdf (offset 521): unable to find /Root dictionary
  2 +/QTest is indirect and has type dictionary (9)
  3 +/QTest is a dictionary
  4 + /Contents is indirect
  5 + /MediaBox is direct
  6 + /Parent is indirect
  7 + /Resources is direct
  8 + /Type is direct
  9 +unparse: 4 0 R
  10 +unparseResolved: << /Contents 7 0 R /MediaBox [ 0 0 612 792 ] /Parent 3 0 R /Resources << /Font << /F1 6 0 R >> /ProcSet 5 0 R >> /Type /Page >>
  11 +test 0 done
... ...
qpdf/qtest/qpdf/fuzz-16214.out
... ... @@ -12,6 +12,7 @@ WARNING: fuzz-16214.pdf: Attempting to reconstruct cross-reference table
12 12 WARNING: fuzz-16214.pdf (offset 7207): error decoding stream data for object 2 0: stream inflate: inflate: data: invalid code lengths set
13 13 WARNING: fuzz-16214.pdf (offset 7207): getStreamData called on unfilterable stream
14 14 WARNING: fuzz-16214.pdf (object 11 0, offset 11551): supposed object stream 5 has wrong type
  15 +WARNING: fuzz-16214.pdf (object 11 0, offset 11551): object stream 5 has incorrect keys
15 16 WARNING: fuzz-16214.pdf (object 21 0, offset 3639): expected endstream
16 17 WARNING: fuzz-16214.pdf (object 21 0, offset 3112): attempting to recover stream length
17 18 WARNING: fuzz-16214.pdf (object 21 0, offset 3112): recovered stream length: 340
... ...