diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-18 00:35:35 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-20 15:16:25 +0200 |
commit | 63c7eefe9db8d8e87d07198355627af01cc1814d (patch) | |
tree | 60564dcdf0c4b465dd2f4ef8e83930b2970d15d1 /libqpdf | |
parent | 56f1b411feeb58b55e92ee77daffaa49c51b7dad (diff) | |
download | qpdf-63c7eefe9db8d8e87d07198355627af01cc1814d.tar.zst |
replaceStreamData: accept uninitialized filter/decode_parms
These mean to leave the original values alone. This is needed for
reconstructing streams from JSON given that the stream data and stream
dictionary may appear in any order in the JSON.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDF_Stream.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index c6f0d873..11dbe7e3 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -725,8 +725,12 @@ QPDF_Stream::replaceFilterData( QPDFObjectHandle const& decode_parms, size_t length) { - this->stream_dict.replaceKey("/Filter", filter); - this->stream_dict.replaceKey("/DecodeParms", decode_parms); + if (filter.isInitialized()) { + this->stream_dict.replaceKey("/Filter", filter); + } + if (decode_parms.isInitialized()) { + this->stream_dict.replaceKey("/DecodeParms", decode_parms); + } if (length == 0) { QTC::TC("qpdf", "QPDF_Stream unknown stream length"); this->stream_dict.removeKey("/Length"); |