Blame SOURCES/qpdf-contents.patch

a8f917
diff -up qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc.contents qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc
a8f917
--- qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc.contents	2020-01-17 12:54:04.170942606 +0100
a8f917
+++ qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc	2020-01-17 12:55:17.944246296 +0100
a8f917
@@ -633,7 +633,7 @@ QPDFObjectHandle::getPageContents()
a8f917
     {
a8f917
 	result.push_back(contents);
a8f917
     }
a8f917
-    else
a8f917
+    else if (! contents.isNull())
a8f917
     {
a8f917
 	throw std::runtime_error("unknown object type inspecting /Contents "
a8f917
 				 "key in page dictionary");
a8f917
diff -up qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out.contents qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out
a8f917
--- qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out.contents	2020-01-17 12:54:04.170942606 +0100
a8f917
+++ qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out	2020-01-17 12:54:04.170942606 +0100
a8f917
@@ -0,0 +1,8 @@
a8f917
+page 1: 3 0 R
a8f917
+  content:
a8f917
+    6 0 R
a8f917
+page 2: 4 0 R
a8f917
+  content:
a8f917
+page 3: 5 0 R
a8f917
+  content:
a8f917
+    9 0 R
a8f917
diff -up qpdf-5.0.1/qpdf/qtest/qpdf.test.contents qpdf-5.0.1/qpdf/qtest/qpdf.test
a8f917
--- qpdf-5.0.1/qpdf/qtest/qpdf.test.contents	2013-10-18 19:51:30.000000000 +0200
a8f917
+++ qpdf-5.0.1/qpdf/qtest/qpdf.test	2020-01-17 12:54:04.171942598 +0100
a8f917
@@ -199,7 +199,7 @@ $td->runtest("remove page we don't have"
a8f917
 show_ntests();
a8f917
 # ----------
a8f917
 $td->notify("--- Miscellaneous Tests ---");
a8f917
-$n_tests += 70;
a8f917
+$n_tests += 71;
a8f917
 
a8f917
 $td->runtest("qpdf version",
a8f917
 	     {$td->COMMAND => "qpdf --version"},
a8f917
@@ -545,6 +545,11 @@ $td->runtest("sanity check array size",
a8f917
               $td->EXIT_STATUS => 2},
a8f917
              $td->NORMALIZE_NEWLINES);
a8f917
 
a8f917
+$td->runtest("handle page no with contents",
a8f917
+             {$td->COMMAND => "qpdf --show-pages page-no-content.pdf"},
a8f917
+             {$td->FILE => "page-no-content.out", $td->EXIT_STATUS => 0},
a8f917
+             $td->NORMALIZE_NEWLINES);
a8f917
+
a8f917
 show_ntests();
a8f917
 # ----------
a8f917
 $td->notify("--- Numeric range parsing tests ---");