aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Stream.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-06-09 23:19:07 +0200
committerJay Berkenbilt <ejb@ql.org>2019-06-09 23:19:49 +0200
commit31bde2f9d7517d3cf2433c2ea787eb9542532496 (patch)
treee471fe49dc981b87a7f25462a324c74c3a086697 /libqpdf/QPDF_Stream.cc
parent74cc3440df7606c1e48bdbcb0ac5051fe0df0149 (diff)
downloadqpdf-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.cc4
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)