diff options
author | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2023-09-02 20:59:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 20:59:16 +0200 |
commit | ec6784411d4f9fbf99a03f8e092e38fd3816049a (patch) | |
tree | b4a3b3b625a2a8e7d81bc738d29e4009550570b1 /libqpdf/QPDF_Dictionary.cc | |
parent | fc656816c142c22f43094d16de99559bfbf0fa2f (diff) | |
parent | ac32dbc313db9490165271d1fa2a602315ddb7e0 (diff) | |
download | qpdf-ec6784411d4f9fbf99a03f8e092e38fd3816049a.tar.zst |
Merge pull request #1028 from m-holger/i1003
Maintain links to foreign pages when copying foreign objects (fixes #1003)
Diffstat (limited to 'libqpdf/QPDF_Dictionary.cc')
-rw-r--r-- | libqpdf/QPDF_Dictionary.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libqpdf/QPDF_Dictionary.cc b/libqpdf/QPDF_Dictionary.cc index 7700b81b..942e6d9e 100644 --- a/libqpdf/QPDF_Dictionary.cc +++ b/libqpdf/QPDF_Dictionary.cc @@ -121,8 +121,10 @@ QPDF_Dictionary::getAsMap() const void QPDF_Dictionary::replaceKey(std::string const& key, QPDFObjectHandle value) { - if (value.isNull()) { - // The PDF spec doesn't distinguish between keys with null values and missing keys. + if (value.isNull() && !value.isIndirect()) { + // The PDF spec doesn't distinguish between keys with null values and missing keys. Allow + // indirect nulls which are equivalent to a dangling reference, which is permitted by the + // spec. removeKey(key); } else { // add or replace value |