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/QPDF_Stream.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/QPDF_Stream.cc')
-rw-r--r-- | libqpdf/QPDF_Stream.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 3733940d..3ddb1498 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -391,6 +391,10 @@ QPDF_Stream::filterable(std::vector<std::string>& filters, QPDFObjectHandle decode_obj = this->stream_dict.getKey("/DecodeParms"); std::vector<QPDFObjectHandle> decode_parms; + if (decode_obj.isArray() && (decode_obj.getArrayNItems() == 0)) + { + decode_obj = QPDFObjectHandle::newNull(); + } if (decode_obj.isArray()) { for (int i = 0; i < decode_obj.getArrayNItems(); ++i) |