aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-09-07 20:11:24 +0200
committerJay Berkenbilt <ejb@ql.org>2022-09-08 16:19:38 +0200
commit4422588d7d51e226e6aeecfa9e53382aeb54d7c4 (patch)
tree2fc7a2bfa89a82ae30abe0f08e4a06ef564b021a /qpdf
parent0132261ee06e9b94bdc011eb4dc3fcd3a403e5f3 (diff)
downloadqpdf-4422588d7d51e226e6aeecfa9e53382aeb54d7c4.tar.zst
Remove unneeded owning_qpdf from QPDFValue
The qpdf member was already sufficient. Removing this actually fixed a few pre-existing issues around detecting foreign ownership and allowing certain conditions to be warnings rather than exceptions.
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/qtest/qpdf/split-tokens-split.out3
-rw-r--r--qpdf/test_driver.cc12
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");