2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-09-19 00:29:07 +00:00

In QPDFOutlineObjectHelper detect loops in direct children

Also, add diagnostic messages in qpdf_fuzzer and additional fuzz test case.
This commit is contained in:
m-holger 2024-06-29 12:38:07 +01:00
parent c93b149b4d
commit 0a081e1f09
5 changed files with 7 additions and 2 deletions

View File

@ -120,6 +120,7 @@ set(CORPUS_OTHER
68915.fuzz 68915.fuzz
69857.fuzz 69857.fuzz
69913.fuzz 69913.fuzz
69969.fuzz
) )
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus) set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)

BIN
fuzz/qpdf_extra/69969.fuzz Normal file

Binary file not shown.

View File

@ -173,8 +173,11 @@ FuzzHelper::doChecks()
{ {
// Get as much coverage as possible in parts of the library that // Get as much coverage as possible in parts of the library that
// might benefit from fuzzing. // might benefit from fuzzing.
std::cout << "starting testWrite\n";
testWrite(); testWrite();
std::cout << "\nstarting testPages\n\n";
testPages(); testPages();
std::cout << "\nstarting testOutlines\n\n";
testOutlines(); testOutlines();
} }

View File

@ -21,7 +21,7 @@ my @fuzzers = (
['pngpredictor' => 1], ['pngpredictor' => 1],
['runlength' => 6], ['runlength' => 6],
['tiffpredictor' => 2], ['tiffpredictor' => 2],
['qpdf' => 62], # increment when adding new files ['qpdf' => 63], # increment when adding new files
); );
my $n_tests = 0; my $n_tests = 0;

View File

@ -23,8 +23,9 @@ QPDFOutlineObjectHelper::QPDFOutlineObjectHelper(
return; return;
} }
QPDFObjGen::set children;
QPDFObjectHandle cur = oh.getKey("/First"); QPDFObjectHandle cur = oh.getKey("/First");
while (!cur.isNull()) { while (!cur.isNull() && children.add(cur)) {
QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth); QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this); new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
m->kids.push_back(new_ooh); m->kids.push_back(new_ooh);