aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-06 20:23:45 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-06 20:29:11 +0100
commitac2b3b96e163c6ef98b708c6392a7e51538dd1cf (patch)
treeb90e4642e49203a83b979cf8900379af95654cb6
parentaf557db4a442db070e90584cb01ef08c3d6a2de1 (diff)
downloadqpdf-ac2b3b96e163c6ef98b708c6392a7e51538dd1cf.tar.zst
Make wrong object stream type a warning
-rw-r--r--libqpdf/QPDF.cc12
-rw-r--r--qpdf/qtest/qpdf.test4
-rw-r--r--qpdf/qtest/qpdf/bad35-recover.out11
-rw-r--r--qpdf/qtest/qpdf/bad35.out11
-rw-r--r--qpdf/qtest/qpdf/fuzz-16214.out1
5 files changed, 29 insertions, 10 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index f690d30a..89c6ed74 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -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() &&
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index f3c452cf..13e7ab3e 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -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;
}
diff --git a/qpdf/qtest/qpdf/bad35-recover.out b/qpdf/qtest/qpdf/bad35-recover.out
index 42336118..4b3a4784 100644
--- a/qpdf/qtest/qpdf/bad35-recover.out
+++ b/qpdf/qtest/qpdf/bad35-recover.out
@@ -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
diff --git a/qpdf/qtest/qpdf/bad35.out b/qpdf/qtest/qpdf/bad35.out
index 42336118..1c373bd2 100644
--- a/qpdf/qtest/qpdf/bad35.out
+++ b/qpdf/qtest/qpdf/bad35.out
@@ -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
diff --git a/qpdf/qtest/qpdf/fuzz-16214.out b/qpdf/qtest/qpdf/fuzz-16214.out
index 2c3be302..21957d35 100644
--- a/qpdf/qtest/qpdf/fuzz-16214.out
+++ b/qpdf/qtest/qpdf/fuzz-16214.out
@@ -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