From 6574dc5c030f866d560dc43cc7a10263ebc71e27 Mon Sep 17 00:00:00 2001 From: m-holger Date: Fri, 25 Aug 2023 12:25:06 +0100 Subject: [PATCH] Store indirect nulls in QPDF_Dictionary --- libqpdf/QPDF_Dictionary.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libqpdf/QPDF_Dictionary.cc b/libqpdf/QPDF_Dictionary.cc index df83632c..942e6d9e 100644 --- a/libqpdf/QPDF_Dictionary.cc +++ b/libqpdf/QPDF_Dictionary.cc @@ -122,7 +122,9 @@ void QPDF_Dictionary::replaceKey(std::string const& key, QPDFObjectHandle value) { if (value.isNull() && !value.isIndirect()) { - // The PDF spec doesn't distinguish between keys with null values and missing keys. + // 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