diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index 89cfd81b..73d886c0 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt @@ -141,6 +141,7 @@ set(CORPUS_OTHER 70306a.fuzz 70306b.fuzz 71624.fuzz + 71689.fuzz ) set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus) diff --git a/fuzz/qpdf_extra/71689.fuzz b/fuzz/qpdf_extra/71689.fuzz new file mode 100644 index 00000000..81911b9c Binary files /dev/null and b/fuzz/qpdf_extra/71689.fuzz differ diff --git a/fuzz/qpdf_fuzzer.cc b/fuzz/qpdf_fuzzer.cc index 490caea4..602983be 100644 --- a/fuzz/qpdf_fuzzer.cc +++ b/fuzz/qpdf_fuzzer.cc @@ -93,13 +93,6 @@ FuzzHelper::testWrite() w->setDeterministicID(true); w->setQDFMode(true); doWrite(w); - - q = getQpdf(); - w = getWriter(q); - w->setStaticID(true); - w->setLinearization(true); - w->setR6EncryptionParameters("u", "o", true, true, true, true, true, true, qpdf_r3p_full, true); - doWrite(w); } void diff --git a/fuzz/qtest/fuzz.test b/fuzz/qtest/fuzz.test index eebc3c10..02dbc98a 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 = 78; # increment when adding new files +my $n_qpdf_files = 79; # increment when adding new files my @fuzzers = ( ['ascii85' => 1], diff --git a/libqpdf/Pl_Flate.cc b/libqpdf/Pl_Flate.cc index b9ad8a02..ad680492 100644 --- a/libqpdf/Pl_Flate.cc +++ b/libqpdf/Pl_Flate.cc @@ -181,7 +181,7 @@ Pl_Flate::handleData(unsigned char const* data, size_t len, int flush) } uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out); if (ready > 0) { - if (memory_limit) { + if (memory_limit && m->action != a_deflate) { m->written += ready; if (m->written > memory_limit) { throw std::runtime_error("PL_Flate memory limit exceeded"); @@ -205,7 +205,7 @@ void Pl_Flate::finish() { if (m->written > memory_limit) { - return; + throw std::runtime_error("PL_Flate memory limit exceeded"); } try { if (m->outbuf.get()) {