diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-06-09 23:19:07 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-06-09 23:19:49 +0200 |
commit | 31bde2f9d7517d3cf2433c2ea787eb9542532496 (patch) | |
tree | e471fe49dc981b87a7f25462a324c74c3a086697 /libqpdf/QPDFWriter.cc | |
parent | 74cc3440df7606c1e48bdbcb0ac5051fe0df0149 (diff) | |
download | qpdf-31bde2f9d7517d3cf2433c2ea787eb9542532496.tar.zst |
Handle empty DecodeParams array for (fixes #331)
On read, ignore /DecodeParms when empty list; on write, delete it.
Some files have been found that include an empty list for
/DecodeParms, but this is not technically compliant with the spec, and
the only sensible interpretation is to treat it as if there are no
decode parameters.
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r-- | libqpdf/QPDFWriter.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index fee287bc..0cc0547d 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -1604,6 +1604,14 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, // Suppress /Length since we will write it manually object.removeKey("/Length"); + // If /DecodeParms is an empty list, remove it. + if (object.getKey("/DecodeParms").isArray() && + (0 == object.getKey("/DecodeParms").getArrayNItems())) + { + QTC::TC("qpdf", "QPDFWriter remove empty DecodeParms"); + object.removeKey("/DecodeParms"); + } + if (flags & f_filtered) { // We will supply our own filter and decode |