diff options
Diffstat (limited to 'qpdf')
-rw-r--r-- | qpdf/qtest/qpdf/split-tokens-split.out | 3 | ||||
-rw-r--r-- | qpdf/test_driver.cc | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/qpdf/qtest/qpdf/split-tokens-split.out b/qpdf/qtest/qpdf/split-tokens-split.out index 828abb5b..8e1003be 100644 --- a/qpdf/qtest/qpdf/split-tokens-split.out +++ b/qpdf/qtest/qpdf/split-tokens-split.out @@ -1,4 +1,5 @@ -WARNING: split-tokens.pdf, object 3 0 at offset 181: Unable to parse content stream: page object 3 0 stream 5 0, stream 7 0, stream 9 0, stream 11 0 (content, offset 375): null character not allowed in name token; not attempting to remove unreferenced objects from this object +WARNING: page object 3 0 stream 5 0, stream 7 0, stream 9 0, stream 11 0 (content, offset 375): null character not allowed in name token +WARNING: split-tokens.pdf, object 3 0 at offset 181: Bad token found while scanning content stream; not attempting to remove unreferenced objects from this object WARNING: empty PDF: content normalization encountered bad tokens WARNING: empty PDF: normalized content ended with a bad token; you may be able to resolve this by coalescing content streams in combination with normalizing content. From the command line, specify --coalesce-contents WARNING: empty PDF: Resulting stream data may be corrupted but is may still useful for manual inspection. For more information on this warning, search for content normalization in the manual. diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 81cefce6..4440bfae 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -1137,8 +1137,16 @@ test_29(QPDF& pdf, char const* arg2) assert(arg2 != 0); QPDF other; other.processFile(arg2); - // Should use copyForeignObject instead - other.getTrailer().replaceKey("/QTest", pdf.getTrailer().getKey("/QTest")); + // We need to create a QPDF with mixed ownership to exercise + // QPDFWriter's ownership check. To do this, we have to sneak the + // foreign object inside an ownerless direct object to avoid + // detection prior to calling QPDFWriter. Maybe a future version + // of qpdf will be able prevent creating mixed ownership. Another + // way to fake it out would be to call setDescription to + // explicitly change the ownership to the wrong value. + auto dict = QPDFObjectHandle::newDictionary(); + dict.replaceKey("/QTest", pdf.getTrailer().getKey("/QTest")); + other.getTrailer().replaceKey("/QTest", dict); try { QPDFWriter w(other, "a.pdf"); |