Blame SOURCES/qpdf-adf.patch

a8f917
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
a8f917
index e30e467..c20aa75 100644
a8f917
--- a/include/qpdf/QPDF.hh
a8f917
+++ b/include/qpdf/QPDF.hh
a8f917
@@ -522,6 +522,18 @@ class QPDF
a8f917
     };
a8f917
     friend class Resolver;
a8f917
 
a8f917
+    // Warner class allows QPDFObjectHandle to create warnings
a8f917
+    class Warner
a8f917
+    {
a8f917
+       friend class QPDFObjectHandle;
a8f917
+      private:
a8f917
+        static void warn(QPDF* qpdf, QPDFExc const& e)
a8f917
+        {
a8f917
+            qpdf->warn(e);
a8f917
+        }
a8f917
+    };
a8f917
+    friend class Warner;
a8f917
+
a8f917
     // Pipe class is restricted to QPDF_Stream
a8f917
     class Pipe
a8f917
     {
a8f917
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
a8f917
index 8140005..e5cabd0 100644
a8f917
--- a/include/qpdf/QPDFObjectHandle.hh
a8f917
+++ b/include/qpdf/QPDFObjectHandle.hh
a8f917
@@ -28,6 +28,7 @@ class QPDF;
a8f917
 class QPDF_Dictionary;
a8f917
 class QPDF_Array;
a8f917
 class QPDFTokenizer;
a8f917
+class QPDFExc;
a8f917
 
a8f917
 class QPDFObjectHandle
a8f917
 {
a8f917
@@ -623,6 +624,9 @@ class QPDFObjectHandle
a8f917
     static void parseContentStream_internal(
a8f917
         QPDFObjectHandle stream, ParserCallbacks* callbacks);
a8f917
 
a8f917
+    // Other methods
a8f917
+    static void warn(QPDF*, QPDFExc const&);
a8f917
+
a8f917
     bool initialized;
a8f917
 
a8f917
     QPDF* qpdf;			// 0 for direct object
a8f917
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
a8f917
index cbdc065..9acea97 100644
a8f917
--- a/include/qpdf/QUtil.hh
a8f917
+++ b/include/qpdf/QUtil.hh
a8f917
@@ -125,6 +125,9 @@ namespace QUtil
a8f917
 
a8f917
     QPDF_DLL
a8f917
     void initializeWithRandomBytes(unsigned char* data, size_t len);
a8f917
+
a8f917
+    QPDF_DLL
a8f917
+    bool is_space(char);
a8f917
 };
a8f917
 
a8f917
 #endif // __QUTIL_HH__
a8f917
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
a8f917
index cae7a7c..245f301 100644
a8f917
--- a/libqpdf/QPDF.cc
a8f917
+++ b/libqpdf/QPDF.cc
a8f917
@@ -1084,6 +1084,11 @@ QPDF::readObject(PointerHolder<InputSource> input,
a8f917
                 else
a8f917
                 {
a8f917
                     QTC::TC("qpdf", "QPDF stream without newline");
a8f917
+                    if (! QUtil::is_space(ch))
a8f917
+                    {
a8f917
+                        QTC::TC("qpdf", "QPDF stream with non-space");
a8f917
+                        input->unreadCh(ch);
a8f917
+                    }
a8f917
                     warn(QPDFExc(qpdf_e_damaged_pdf, input->getName(),
a8f917
                                  this->last_object_description,
a8f917
                                  input->tell(),
a8f917
@@ -1274,9 +1280,9 @@ QPDF::recoverStreamLength(PointerHolder<InputSource> input,
a8f917
 
a8f917
     if (length == 0)
a8f917
     {
a8f917
-	throw QPDFExc(qpdf_e_damaged_pdf, input->getName(),
a8f917
+	warn(QPDFExc(qpdf_e_damaged_pdf, input->getName(),
a8f917
 		      this->last_object_description, stream_offset,
a8f917
-		      "unable to recover stream data");
a8f917
+		      "unable to recover stream data; treating stream as empty"));
a8f917
     }
a8f917
 
a8f917
     QTC::TC("qpdf", "QPDF recovered stream length");
a8f917
@@ -1459,31 +1465,41 @@ QPDF::resolve(int objid, int generation)
a8f917
 	}
a8f917
 
a8f917
 	QPDFXRefEntry const& entry = this->xref_table[og];
a8f917
-	switch (entry.getType())
a8f917
-	{
a8f917
-	  case 1:
a8f917
-	    {
a8f917
-		qpdf_offset_t offset = entry.getOffset();
a8f917
-		// Object stored in cache by readObjectAtOffset
a8f917
-		int aobjid;
a8f917
-		int ageneration;
a8f917
-		QPDFObjectHandle oh =
a8f917
-		    readObjectAtOffset(true, offset, "", objid, generation,
a8f917
-				       aobjid, ageneration);
a8f917
-	    }
a8f917
-	    break;
a8f917
+        try
a8f917
+        {
a8f917
+            switch (entry.getType())
a8f917
+            {
a8f917
+              case 1:
a8f917
+                {
a8f917
+                    qpdf_offset_t offset = entry.getOffset();
a8f917
+                    // Object stored in cache by readObjectAtOffset
a8f917
+                    int aobjid;
a8f917
+                    int ageneration;
a8f917
+                    QPDFObjectHandle oh =
a8f917
+                        readObjectAtOffset(true, offset, "", objid, generation,
a8f917
+                                           aobjid, ageneration);
a8f917
+                }
a8f917
+                break;
a8f917
 
a8f917
-	  case 2:
a8f917
-	    resolveObjectsInStream(entry.getObjStreamNumber());
a8f917
-	    break;
a8f917
+              case 2:
a8f917
+                resolveObjectsInStream(entry.getObjStreamNumber());
a8f917
+                break;
a8f917
 
a8f917
-	  default:
a8f917
-	    throw QPDFExc(qpdf_e_damaged_pdf, this->file->getName(), "", 0,
a8f917
-			  "object " +
a8f917
-			  QUtil::int_to_string(objid) + "/" +
a8f917
-			  QUtil::int_to_string(generation) +
a8f917
-			  " has unexpected xref entry type");
a8f917
-	}
a8f917
+              default:
a8f917
+                throw QPDFExc(qpdf_e_damaged_pdf, this->file->getName(), "", 0,
a8f917
+                              "object " +
a8f917
+                              QUtil::int_to_string(objid) + "/" +
a8f917
+                              QUtil::int_to_string(generation) +
a8f917
+                              " has unexpected xref entry type");
a8f917
+            }
a8f917
+        }
a8f917
+        catch (QPDFExc& e)
a8f917
+        {
a8f917
+            warn(e);
a8f917
+            QPDFObjectHandle oh = QPDFObjectHandle::newNull();
a8f917
+            this->obj_cache[og] =
a8f917
+                ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1);
a8f917
+        }
a8f917
     }
a8f917
 
a8f917
     return this->obj_cache[og].object;
a8f917
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
a8f917
index eec4fae..55f8099 100644
a8f917
--- a/libqpdf/QPDFObjectHandle.cc
a8f917
+++ b/libqpdf/QPDFObjectHandle.cc
a8f917
@@ -1533,3 +1533,20 @@ QPDFObjectHandle::dereference()
a8f917
         }
a8f917
     }
a8f917
 }
a8f917
+
a8f917
+void
a8f917
+QPDFObjectHandle::warn(QPDF* qpdf, QPDFExc const& e)
a8f917
+{
a8f917
+    // If parsing on behalf of a QPDF object and want to give a
a8f917
+    // warning, we can warn through the object. If parsing for some
a8f917
+    // other reason, such as an explicit creation of an object from a
a8f917
+    // string, then just throw the exception.
a8f917
+    if (qpdf)
a8f917
+    {
a8f917
+        QPDF::Warner::warn(qpdf, e);
a8f917
+    }
a8f917
+    else
a8f917
+    {
a8f917
+        throw e;
a8f917
+    }
a8f917
+}
a8f917
diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc
a8f917
index 91b1682..8ed6afc 100644
a8f917
--- a/libqpdf/QPDFTokenizer.cc
a8f917
+++ b/libqpdf/QPDFTokenizer.cc
a8f917
@@ -7,6 +7,7 @@
a8f917
 #include <qpdf/PCRE.hh>
a8f917
 #include <qpdf/QTC.hh>
a8f917
 #include <qpdf/QPDFExc.hh>
a8f917
+#include <qpdf/QUtil.hh>
a8f917
 
a8f917
 #include <stdexcept>
a8f917
 #include <string.h>
a8f917
@@ -16,10 +17,6 @@ static bool is_hex_digit(char ch)
a8f917
 {
a8f917
     return (strchr("0123456789abcdefABCDEF", ch) != 0);
a8f917
 }
a8f917
-static bool is_space(char ch)
a8f917
-{
a8f917
-    return (strchr(" \f\n\r\t\v", ch) != 0);
a8f917
-}
a8f917
 
a8f917
 QPDFTokenizer::QPDFTokenizer() :
a8f917
     pound_special_in_name(true),
a8f917
@@ -511,7 +508,7 @@ QPDFTokenizer::readToken(PointerHolder<InputSource> input,
a8f917
 	}
a8f917
 	else
a8f917
 	{
a8f917
-	    if (is_space(static_cast<unsigned char>(ch)) &&
a8f917
+            if (QUtil::is_space(static_cast<unsigned char>(ch)) &&
a8f917
 		(input->getLastOffset() == offset))
a8f917
 	    {
a8f917
 		++offset;
a8f917
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc
a8f917
index cf45506..5f9c608 100644
a8f917
--- a/libqpdf/QUtil.cc
a8f917
+++ b/libqpdf/QUtil.cc
a8f917
@@ -490,3 +490,9 @@ QUtil::srandom(unsigned int seed)
a8f917
     srand(seed);
a8f917
 #endif
a8f917
 }
a8f917
+
a8f917
+bool
a8f917
+QUtil::is_space(char ch)
a8f917
+{
a8f917
+    return (strchr(" \f\n\r\t\v", ch) != 0);
a8f917
+}
a8f917
diff --git a/qpdf/qpdf.testcov b/qpdf/qpdf.testcov
a8f917
index e78a4f4..85ddef3 100644
a8f917
--- a/qpdf/qpdf.testcov
a8f917
+++ b/qpdf/qpdf.testcov
a8f917
@@ -268,3 +268,4 @@ QPDF xref space 2
a8f917
 qpdf pages range omitted at end 0
a8f917
 qpdf pages range omitted in middle 0
a8f917
 qpdf npages 0
a8f917
+QPDF stream with non-space 0
a8f917
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
a8f917
index 3b7ede5..354445b 100644
a8f917
--- a/qpdf/qtest/qpdf.test
a8f917
+++ b/qpdf/qtest/qpdf.test
a8f917
@@ -435,7 +435,7 @@ $td->runtest("EOF terminating literal tokens",
a8f917
              $td->NORMALIZE_NEWLINES);
a8f917
 $td->runtest("EOF reading token",
a8f917
              {$td->COMMAND => "qpdf --check eof-reading-token.pdf"},
a8f917
-             {$td->FILE => "eof-reading-token.out", $td->EXIT_STATUS => 2},
a8f917
+             {$td->FILE => "eof-reading-token.out", $td->EXIT_STATUS => 3},
a8f917
              $td->NORMALIZE_NEWLINES);
a8f917
 $td->runtest("extra header text",
a8f917
              {$td->COMMAND => "test_driver 32 minimal.pdf"},
a8f917
@@ -739,7 +739,9 @@ $n_tests += @badfiles + 5;
a8f917
 # neither Acrobat nor other PDF viewers really care.  Tests 12 and 28
a8f917
 # have error conditions that used to be fatal but are now considered
a8f917
 # non-fatal.
a8f917
-my %badtest_overrides = (6 => 0, 12 => 0, 28 => 0, 31 => 0);
a8f917
+my %badtest_overrides = (6 => 0, 12 => 0, 22 => 0, 23 => 0, 24 => 0,
a8f917
+                         25 => 0, 26 => 0, 27 => 0, 28 => 0, 31 => 0,
a8f917
+                         32 => 0, 34 => 0);
a8f917
 for (my $i = 1; $i <= scalar(@badfiles); ++$i)
a8f917
 {
a8f917
     my $status = $badtest_overrides{$i};
a8f917
@@ -788,7 +790,7 @@ $n_tests += @badfiles + 8;
a8f917
 # though in some cases it may.  Acrobat Reader would not be able to
a8f917
 # recover any of these files any better.
a8f917
 my %recover_failures = ();
a8f917
-for (1, 7, 13..21, 24, 29..30, 33, 35)
a8f917
+for (1, 7, 13..21, 29..30, 33, 35)
a8f917
 {
a8f917
     $recover_failures{$_} = 1;
a8f917
 }
a8f917
diff --git a/qpdf/qtest/qpdf/bad22.out b/qpdf/qtest/qpdf/bad22.out
a8f917
index ec6d5f8..73d081e 100644
a8f917
--- a/qpdf/qtest/qpdf/bad22.out
a8f917
+++ b/qpdf/qtest/qpdf/bad22.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad22.pdf (object 4 0, file position 314): stream dictionary lacks /Length key
a8f917
+WARNING: bad22.pdf (object 4 0, file position 314): stream dictionary lacks /Length key
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad23.out b/qpdf/qtest/qpdf/bad23.out
a8f917
index b4cf25e..9bc1bdc 100644
a8f917
--- a/qpdf/qtest/qpdf/bad23.out
a8f917
+++ b/qpdf/qtest/qpdf/bad23.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad23.pdf (object 4 0, file position 314): /Length key in stream dictionary is not an integer
a8f917
+WARNING: bad23.pdf (object 4 0, file position 314): /Length key in stream dictionary is not an integer
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad24-recover.out b/qpdf/qtest/qpdf/bad24-recover.out
a8f917
index 0af01e9..d1bbe73 100644
a8f917
--- a/qpdf/qtest/qpdf/bad24-recover.out
a8f917
+++ b/qpdf/qtest/qpdf/bad24-recover.out
a8f917
@@ -1,2 +1,9 @@
a8f917
 WARNING: bad24.pdf (object 4 0, file position 341): attempting to recover stream length
a8f917
-bad24.pdf (object 4 0, file position 341): unable to recover stream data
a8f917
+WARNING: bad24.pdf (object 4 0, file position 341): unable to recover stream data; treating stream as empty
a8f917
+WARNING: bad24.pdf (object 4 0, file position 778): EOF while reading token
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 1 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad24.out b/qpdf/qtest/qpdf/bad24.out
a8f917
index f503214..0a4dc8e 100644
a8f917
--- a/qpdf/qtest/qpdf/bad24.out
a8f917
+++ b/qpdf/qtest/qpdf/bad24.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad24.pdf (object 4 0, file position 385): expected endstream
a8f917
+WARNING: bad24.pdf (object 4 0, file position 385): expected endstream
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad25.out b/qpdf/qtest/qpdf/bad25.out
a8f917
index f336b34..d6b13e4 100644
a8f917
--- a/qpdf/qtest/qpdf/bad25.out
a8f917
+++ b/qpdf/qtest/qpdf/bad25.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad25.pdf (object 4 0, file position 307): expected n n obj
a8f917
+WARNING: bad25.pdf (object 4 0, file position 307): expected n n obj
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad26.out b/qpdf/qtest/qpdf/bad26.out
a8f917
index 30c3b72..48263e5 100644
a8f917
--- a/qpdf/qtest/qpdf/bad26.out
a8f917
+++ b/qpdf/qtest/qpdf/bad26.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad26.pdf (object 4 0, file position 307): expected n n obj
a8f917
+WARNING: bad26.pdf (object 4 0, file position 307): expected n n obj
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad27.out b/qpdf/qtest/qpdf/bad27.out
a8f917
index 2c494e4..4f38cca 100644
a8f917
--- a/qpdf/qtest/qpdf/bad27.out
a8f917
+++ b/qpdf/qtest/qpdf/bad27.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad27.pdf (object 4 0, file position 307): expected n n obj
a8f917
+WARNING: bad27.pdf (object 4 0, file position 307): expected n n obj
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad32.out b/qpdf/qtest/qpdf/bad32.out
a8f917
index 60727cc..9b37770 100644
a8f917
--- a/qpdf/qtest/qpdf/bad32.out
a8f917
+++ b/qpdf/qtest/qpdf/bad32.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad32.pdf (object 4 0, file position 307): expected 4 0 obj
a8f917
+WARNING: bad32.pdf (object 4 0, file position 307): expected 4 0 obj
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad34.out b/qpdf/qtest/qpdf/bad34.out
a8f917
index ee65e14..7ba7916 100644
a8f917
--- a/qpdf/qtest/qpdf/bad34.out
a8f917
+++ b/qpdf/qtest/qpdf/bad34.out
a8f917
@@ -1 +1,7 @@
a8f917
-bad34.pdf (object 4 0, file position 322): expected n n obj
a8f917
+WARNING: bad34.pdf (object 4 0, file position 322): expected n n obj
a8f917
+/QTest is implicit
a8f917
+/QTest is indirect and has type null (2)
a8f917
+/QTest is null
a8f917
+unparse: 4 0 R
a8f917
+unparseResolved: null
a8f917
+test 0 done
a8f917
diff --git a/qpdf/qtest/qpdf/bad35-recover.out b/qpdf/qtest/qpdf/bad35-recover.out
a8f917
index add1666..db7ff5d 100644
a8f917
--- a/qpdf/qtest/qpdf/bad35-recover.out
a8f917
+++ b/qpdf/qtest/qpdf/bad35-recover.out
a8f917
@@ -1 +1,2 @@
a8f917
-bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type
a8f917
+WARNING: bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type
a8f917
+operation for Dictionary object attempted on object of wrong type
a8f917
diff --git a/qpdf/qtest/qpdf/bad35.out b/qpdf/qtest/qpdf/bad35.out
a8f917
index add1666..db7ff5d 100644
a8f917
--- a/qpdf/qtest/qpdf/bad35.out
a8f917
+++ b/qpdf/qtest/qpdf/bad35.out
a8f917
@@ -1 +1,2 @@
a8f917
-bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type
a8f917
+WARNING: bad35.pdf (object 1 0, file position 521): supposed object stream 1 has wrong type
a8f917
+operation for Dictionary object attempted on object of wrong type
a8f917
diff --git a/qpdf/qtest/qpdf/eof-reading-token.out b/qpdf/qtest/qpdf/eof-reading-token.out
a8f917
index 58e5b09..fefc516 100644
a8f917
--- a/qpdf/qtest/qpdf/eof-reading-token.out
a8f917
+++ b/qpdf/qtest/qpdf/eof-reading-token.out
a8f917
@@ -2,4 +2,4 @@ checking eof-reading-token.pdf
a8f917
 PDF Version: 1.3
a8f917
 File is not encrypted
a8f917
 File is not linearized
a8f917
-object stream 12 (file position 5): EOF while reading token
a8f917
+WARNING: object stream 12 (file position 5): EOF while reading token
a8f917
diff --git a/qpdf/qtest/qpdf/stream-line-enders.out b/qpdf/qtest/qpdf/stream-line-enders.out
a8f917
index b7a7513..1932771 100644
a8f917
--- a/qpdf/qtest/qpdf/stream-line-enders.out
a8f917
+++ b/qpdf/qtest/qpdf/stream-line-enders.out
a8f917
@@ -1,3 +1,4 @@
a8f917
-WARNING: stream-line-enders.pdf (object 5 0, file position 378): stream keyword followed by carriage return only
a8f917
-WARNING: stream-line-enders.pdf (object 6 0, file position 437): stream keyword not followed by proper line terminator
a8f917
+WARNING: stream-line-enders.pdf (object 5 0, file position 384): stream keyword followed by carriage return only
a8f917
+WARNING: stream-line-enders.pdf (object 6 0, file position 443): stream keyword not followed by proper line terminator
a8f917
+WARNING: stream-line-enders.pdf (object 7 0, file position 503): stream keyword not followed by proper line terminator
a8f917
 qpdf: operation succeeded with warnings; resulting file may have some problems
a8f917
diff --git a/qpdf/qtest/qpdf/stream-line-enders.pdf b/qpdf/qtest/qpdf/stream-line-enders.pdf
a8f917
index e623888..2e05caa 100644
a8f917
--- a/qpdf/qtest/qpdf/stream-line-enders.pdf
a8f917
+++ b/qpdf/qtest/qpdf/stream-line-enders.pdf
a8f917
@@ -7,7 +7,7 @@ endobj
a8f917
 << /Count 1 /Kids [ 3 0 R ] /Type /Pages >>
a8f917
 endobj
a8f917
 3 0 obj
a8f917
-<< /Contents [ 4 0 R 5 0 R 6 0 R ] /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 7 0 R >> /ProcSet 8 0 R >> /Type /Page >>
a8f917
+<< /Contents [ 4 0 R 5 0 R 6 0 R 7 0 R ] /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 8 0 R >> /ProcSet 9 0 R >> /Type /Page >>
a8f917
 endobj
a8f917
 4 0 obj
a8f917
 << /Length 14 >>
a8f917
@@ -22,29 +22,35 @@ stream
72 720 Td
a8f917
 endstream
a8f917
 endobj
a8f917
 6 0 obj
a8f917
-<< /Length 15 >>
a8f917
+<< /Length 12 >>
a8f917
 stream (Potato) Tj
a8f917
-ET
a8f917
 endstream
a8f917
 endobj
a8f917
 7 0 obj
a8f917
-<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >>
a8f917
+<< /Length 11 >>
a8f917
+stream%comment
a8f917
+ET
a8f917
+endstream
a8f917
 endobj
a8f917
 8 0 obj
a8f917
+<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >>
a8f917
+endobj
a8f917
+9 0 obj
a8f917
 [ /PDF /Text ]
a8f917
 endobj
a8f917
 xref
a8f917
-0 9
a8f917
+0 10
a8f917
 0000000000 65535 f 
a8f917
 0000000015 00000 n 
a8f917
 0000000064 00000 n 
a8f917
 0000000123 00000 n 
a8f917
-0000000282 00000 n 
a8f917
-0000000346 00000 n 
a8f917
-0000000405 00000 n 
a8f917
-0000000469 00000 n 
a8f917
-0000000576 00000 n 
a8f917
-trailer << /Root 1 0 R /Size 9 /ID [<08aa98c73f8a7262d77c8328772c3989><7b1f32865e2165debe277f27ee790092>] >>
a8f917
+0000000288 00000 n 
a8f917
+0000000352 00000 n 
a8f917
+0000000411 00000 n 
a8f917
+0000000472 00000 n 
a8f917
+0000000532 00000 n 
a8f917
+0000000639 00000 n 
a8f917
+trailer << /Root 1 0 R /Size 10 /ID [<08aa98c73f8a7262d77c8328772c3989><5a35fde138b2e8251b9e079b560c0253>] >>
a8f917
 startxref
a8f917
-606
a8f917
+669
a8f917
 %%EOF
a8f917
diff --git a/qpdf/qtest/qpdf/stream-line-enders.qdf b/qpdf/qtest/qpdf/stream-line-enders.qdf
a8f917
index 3353602..aa14901 100644
a8f917
--- a/qpdf/qtest/qpdf/stream-line-enders.qdf
a8f917
+++ b/qpdf/qtest/qpdf/stream-line-enders.qdf
a8f917
@@ -29,6 +29,7 @@ endobj
a8f917
     4 0 R
a8f917
     6 0 R
a8f917
     8 0 R
a8f917
+    10 0 R
a8f917
   ]
a8f917
   /MediaBox [
a8f917
     0
a8f917
@@ -39,9 +40,9 @@ endobj
a8f917
   /Parent 2 0 R
a8f917
   /Resources <<
a8f917
     /Font <<
a8f917
-      /F1 10 0 R
a8f917
+      /F1 12 0 R
a8f917
     >>
a8f917
-    /ProcSet 11 0 R
a8f917
+    /ProcSet 13 0 R
a8f917
   >>
a8f917
   /Type /Page
a8f917
 >>
a8f917
@@ -86,16 +87,31 @@ endobj
a8f917
 >>
a8f917
 stream
a8f917
 (Potato) Tj
a8f917
-ET
a8f917
 endstream
a8f917
 endobj
a8f917
 
a8f917
 9 0 obj
a8f917
-15
a8f917
+12
a8f917
 endobj
a8f917
 
a8f917
+%% Contents for page 1
a8f917
 %% Original object ID: 7 0
a8f917
 10 0 obj
a8f917
+<<
a8f917
+  /Length 11 0 R
a8f917
+>>
a8f917
+stream
a8f917
+%comment
a8f917
+ET
a8f917
+endstream
a8f917
+endobj
a8f917
+
a8f917
+11 0 obj
a8f917
+12
a8f917
+endobj
a8f917
+
a8f917
+%% Original object ID: 8 0
a8f917
+12 0 obj
a8f917
 <<
a8f917
   /BaseFont /Helvetica
a8f917
   /Encoding /WinAnsiEncoding
a8f917
@@ -105,8 +121,8 @@ endobj
a8f917
 >>
a8f917
 endobj
a8f917
 
a8f917
-%% Original object ID: 8 0
a8f917
-11 0 obj
a8f917
+%% Original object ID: 9 0
a8f917
+13 0 obj
a8f917
 [
a8f917
   /PDF
a8f917
   /Text
a8f917
@@ -114,24 +130,26 @@ endobj
a8f917
 endobj
a8f917
 
a8f917
 xref
a8f917
-0 12
a8f917
+0 14
a8f917
 0000000000 65535 f 
a8f917
 0000000052 00000 n 
a8f917
 0000000133 00000 n 
a8f917
 0000000242 00000 n 
a8f917
-0000000516 00000 n 
a8f917
-0000000585 00000 n 
a8f917
-0000000654 00000 n 
a8f917
-0000000719 00000 n 
a8f917
-0000000788 00000 n 
a8f917
-0000000858 00000 n 
a8f917
-0000000904 00000 n 
a8f917
-0000001050 00000 n 
a8f917
+0000000527 00000 n 
a8f917
+0000000596 00000 n 
a8f917
+0000000665 00000 n 
a8f917
+0000000730 00000 n 
a8f917
+0000000799 00000 n 
a8f917
+0000000866 00000 n 
a8f917
+0000000935 00000 n 
a8f917
+0000001004 00000 n 
a8f917
+0000001051 00000 n 
a8f917
+0000001197 00000 n 
a8f917
 trailer <<
a8f917
   /Root 1 0 R
a8f917
-  /Size 12
a8f917
+  /Size 14
a8f917
   /ID [<08aa98c73f8a7262d77c8328772c3989><31415926535897932384626433832795>]
a8f917
 >>
a8f917
 startxref
a8f917
-1086
a8f917
+1233
a8f917
 %%EOF