Make wrong object stream type a warning

This commit is contained in:
Jay Berkenbilt 2021-02-06 14:23:45 -05:00
parent af557db4a4
commit ac2b3b96e1
5 changed files with 29 additions and 10 deletions

View File

@ -2187,12 +2187,12 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
dict.getKey("/Type").getName() == "/ObjStm"))
{
QTC::TC("qpdf", "QPDF ERR object stream with wrong type");
throw QPDFExc(qpdf_e_damaged_pdf, this->m->file->getName(),
this->m->last_object_description,
this->m->file->getLastOffset(),
"supposed object stream " +
QUtil::int_to_string(obj_stream_number) +
" has wrong type");
warn(QPDFExc(qpdf_e_damaged_pdf, this->m->file->getName(),
this->m->last_object_description,
this->m->file->getLastOffset(),
"supposed object stream " +
QUtil::int_to_string(obj_stream_number) +
" has wrong type"));
}
if (! (dict.getKey("/N").isInteger() &&

View File

@ -2655,7 +2655,7 @@ $n_tests += @badfiles + 7;
# have error conditions that used to be fatal but are now considered
# non-fatal.
my %badtest_overrides = ();
for(6, 12..15, 17, 18..32, 34, 36..37)
for(6, 12..15, 17, 18..32, 34..37)
{
$badtest_overrides{$_} = 0;
}
@ -2715,7 +2715,7 @@ $n_tests += @badfiles + 9;
# though in some cases it may. Acrobat Reader would not be able to
# recover any of these files any better.
my %recover_failures = ();
for (1, 7, 16, 35)
for (1, 7, 16)
{
$recover_failures{$_} = 1;
}

View File

@ -1,2 +1,11 @@
WARNING: bad35.pdf (object 1 0, offset 521): supposed object stream 1 has wrong type
bad35.pdf (offset 521): unable to find /Root dictionary
/QTest is indirect and has type dictionary (9)
/QTest is a dictionary
/Contents is indirect
/MediaBox is direct
/Parent is indirect
/Resources is direct
/Type is direct
unparse: 4 0 R
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 >>
test 1 done

View File

@ -1,2 +1,11 @@
WARNING: bad35.pdf (object 1 0, offset 521): supposed object stream 1 has wrong type
bad35.pdf (offset 521): unable to find /Root dictionary
/QTest is indirect and has type dictionary (9)
/QTest is a dictionary
/Contents is indirect
/MediaBox is direct
/Parent is indirect
/Resources is direct
/Type is direct
unparse: 4 0 R
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 >>
test 0 done

View File

@ -12,6 +12,7 @@ WARNING: fuzz-16214.pdf: Attempting to reconstruct cross-reference table
WARNING: fuzz-16214.pdf (offset 7207): error decoding stream data for object 2 0: stream inflate: inflate: data: invalid code lengths set
WARNING: fuzz-16214.pdf (offset 7207): getStreamData called on unfilterable stream
WARNING: fuzz-16214.pdf (object 11 0, offset 11551): supposed object stream 5 has wrong type
WARNING: fuzz-16214.pdf (object 11 0, offset 11551): object stream 5 has incorrect keys
WARNING: fuzz-16214.pdf (object 21 0, offset 3639): expected endstream
WARNING: fuzz-16214.pdf (object 21 0, offset 3112): attempting to recover stream length
WARNING: fuzz-16214.pdf (object 21 0, offset 3112): recovered stream length: 340