summaryrefslogtreecommitdiffstats
path: root/qpdf/test_driver.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2020-10-22 00:50:29 +0200
committerJay Berkenbilt <ejb@ql.org>2020-10-22 01:23:23 +0200
commit956c8f643219778c445d7062d1d0e7e3b96c7676 (patch)
tree655f22733fe2a91babf9f055eab1c9d78da792e7 /qpdf/test_driver.cc
parentad96e1ad74372df5cda83bcf02fc16de72c77f10 (diff)
downloadqpdf-956c8f643219778c445d7062d1d0e7e3b96c7676.tar.zst
Obscure bug fix copying foreign streams in special cases (fixes #449)
Specifically, if a stream had its stream data replaced and had indirect /Filter or /DecodeParms, it would result in non-silent loss of data and/or internal error.
Diffstat (limited to 'qpdf/test_driver.cc')
-rw-r--r--qpdf/test_driver.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc
index 07445dea..167c509b 100644
--- a/qpdf/test_driver.cc
+++ b/qpdf/test_driver.cc
@@ -2195,6 +2195,22 @@ void runtest(int n, char const* filename1, char const* arg2)
std::cout << "raw stream data okay" << std::endl;
}
}
+ else if (n == 69)
+ {
+ pdf.setImmediateCopyFrom(true);
+ auto pages = pdf.getAllPages();
+ for (size_t i = 0; i < pages.size(); ++i)
+ {
+ QPDF out;
+ out.emptyPDF();
+ out.addPage(pages.at(i), false);
+ std::string outname = std::string("auto-") +
+ QUtil::uint_to_string(i) + ".pdf";
+ QPDFWriter w(out, outname.c_str());
+ w.setStaticID(true);
+ w.write();
+ }
+ }
else
{
throw std::runtime_error(std::string("invalid test ") +