From 73878a80152d617800a360e31fd4d439502937de Mon Sep 17 00:00:00 2001 From: m-holger Date: Sun, 31 Aug 2025 11:58:44 +0100 Subject: [PATCH] Fix `replaceKey` in `BaseDictionary`: update to use `null`/`indirect` API. --- fuzz/CMakeLists.txt | 1 + fuzz/qpdf_extra/5828408539152384.fuzz | Bin 0 -> 1707 bytes fuzz/qtest/fuzz.test | 2 +- libqpdf/QPDF_Dictionary.cc | 2 +- 4 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 fuzz/qpdf_extra/5828408539152384.fuzz diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index a437cc7..0b81397 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt @@ -163,6 +163,7 @@ set(CORPUS_OTHER 440747125.fuzz 4720043549327360.fuzz 5109284021272576.fuzz + 5828408539152384.fuzz 6489005569146880.fuzz ) diff --git a/fuzz/qpdf_extra/5828408539152384.fuzz b/fuzz/qpdf_extra/5828408539152384.fuzz new file mode 100644 index 0000000..adcbd40 Binary files /dev/null and b/fuzz/qpdf_extra/5828408539152384.fuzz differ diff --git a/fuzz/qtest/fuzz.test b/fuzz/qtest/fuzz.test index d141db7..ecafb06 100644 --- a/fuzz/qtest/fuzz.test +++ b/fuzz/qtest/fuzz.test @@ -11,7 +11,7 @@ my $td = new TestDriver('fuzz'); my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS"; -my $n_qpdf_files = 101; # increment when adding new files +my $n_qpdf_files = 102; # increment when adding new files my @fuzzers = ( ['ascii85' => 1], diff --git a/libqpdf/QPDF_Dictionary.cc b/libqpdf/QPDF_Dictionary.cc index 501ab61..f02a7bb 100644 --- a/libqpdf/QPDF_Dictionary.cc +++ b/libqpdf/QPDF_Dictionary.cc @@ -67,7 +67,7 @@ void BaseDictionary::replaceKey(std::string const& key, QPDFObjectHandle value) { auto d = dict(); - if (value.isNull() && !value.isIndirect()) { + if (value.null() && !value.indirect()) { // 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. -- libgit2 0.21.4