diff options
author | m-holger <m-holger@kubitscheck.org> | 2023-09-03 11:50:06 +0200 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2023-09-03 11:50:06 +0200 |
commit | ca79fcb26e1e1fa94bd1119119eac17b5140c196 (patch) | |
tree | 8a2172b8b01d0b1439e077ec9057e3977c8acccc | |
parent | 0046de0852e5fcdc2dfe50de35f6a9922eb6326a (diff) | |
download | qpdf-ca79fcb26e1e1fa94bd1119119eac17b5140c196.tar.zst |
Add test for attempts to copy foreign /Pages object
-rw-r--r-- | qpdf/qtest/qpdf/copy-foreign-objects-25.out | 1 | ||||
-rw-r--r-- | qpdf/test_driver.cc | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/qpdf/qtest/qpdf/copy-foreign-objects-25.out b/qpdf/qtest/qpdf/copy-foreign-objects-25.out index da8906a7..a34184ac 100644 --- a/qpdf/qtest/qpdf/copy-foreign-objects-25.out +++ b/qpdf/qtest/qpdf/copy-foreign-objects-25.out @@ -1 +1,2 @@ +WARNING: minimal.pdf (object 6 0, offset 556): Unexpected reference to /Pages object while copying foreign object. Replacing with Null object. test 25 done diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index b2ed825d..2e661fdb 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -954,6 +954,8 @@ test_25(QPDF& pdf, char const* arg2) // Copy qtest without crossing page boundaries. Should get O1 // and O2 and their streams but not O3 or any other pages. + // Also verify that attempts to copy /Pages objects return null. + assert(arg2 != nullptr); { // Make sure original PDF is out of scope when we write. @@ -961,6 +963,8 @@ test_25(QPDF& pdf, char const* arg2) oldpdf.processFile(arg2); QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); pdf.getTrailer().replaceKey("/QTest", pdf.copyForeignObject(qtest)); + + assert(pdf.copyForeignObject(oldpdf.getRoot().getKey("/Pages")).isNull()); } QPDFWriter w(pdf, "a.pdf"); |