Commit 0a081e1f097e29e022cd04c12ffcfa7691107ba4
1 parent
c93b149b
In QPDFOutlineObjectHelper detect loops in direct children
Also, add diagnostic messages in qpdf_fuzzer and additional fuzz test case.
Showing
5 changed files
with
7 additions
and
2 deletions
fuzz/CMakeLists.txt
| @@ -120,6 +120,7 @@ set(CORPUS_OTHER | @@ -120,6 +120,7 @@ set(CORPUS_OTHER | ||
| 120 | 68915.fuzz | 120 | 68915.fuzz |
| 121 | 69857.fuzz | 121 | 69857.fuzz |
| 122 | 69913.fuzz | 122 | 69913.fuzz |
| 123 | + 69969.fuzz | ||
| 123 | ) | 124 | ) |
| 124 | 125 | ||
| 125 | set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus) | 126 | set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus) |
fuzz/qpdf_extra/69969.fuzz
0 → 100644
No preview for this file type
fuzz/qpdf_fuzzer.cc
| @@ -173,8 +173,11 @@ FuzzHelper::doChecks() | @@ -173,8 +173,11 @@ FuzzHelper::doChecks() | ||
| 173 | { | 173 | { |
| 174 | // Get as much coverage as possible in parts of the library that | 174 | // Get as much coverage as possible in parts of the library that |
| 175 | // might benefit from fuzzing. | 175 | // might benefit from fuzzing. |
| 176 | + std::cout << "starting testWrite\n"; | ||
| 176 | testWrite(); | 177 | testWrite(); |
| 178 | + std::cout << "\nstarting testPages\n\n"; | ||
| 177 | testPages(); | 179 | testPages(); |
| 180 | + std::cout << "\nstarting testOutlines\n\n"; | ||
| 178 | testOutlines(); | 181 | testOutlines(); |
| 179 | } | 182 | } |
| 180 | 183 |
fuzz/qtest/fuzz.test
| @@ -21,7 +21,7 @@ my @fuzzers = ( | @@ -21,7 +21,7 @@ my @fuzzers = ( | ||
| 21 | ['pngpredictor' => 1], | 21 | ['pngpredictor' => 1], |
| 22 | ['runlength' => 6], | 22 | ['runlength' => 6], |
| 23 | ['tiffpredictor' => 2], | 23 | ['tiffpredictor' => 2], |
| 24 | - ['qpdf' => 62], # increment when adding new files | 24 | + ['qpdf' => 63], # increment when adding new files |
| 25 | ); | 25 | ); |
| 26 | 26 | ||
| 27 | my $n_tests = 0; | 27 | my $n_tests = 0; |
libqpdf/QPDFOutlineObjectHelper.cc
| @@ -23,8 +23,9 @@ QPDFOutlineObjectHelper::QPDFOutlineObjectHelper( | @@ -23,8 +23,9 @@ QPDFOutlineObjectHelper::QPDFOutlineObjectHelper( | ||
| 23 | return; | 23 | return; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | + QPDFObjGen::set children; | ||
| 26 | QPDFObjectHandle cur = oh.getKey("/First"); | 27 | QPDFObjectHandle cur = oh.getKey("/First"); |
| 27 | - while (!cur.isNull()) { | 28 | + while (!cur.isNull() && children.add(cur)) { |
| 28 | QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth); | 29 | QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth); |
| 29 | new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this); | 30 | new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this); |
| 30 | m->kids.push_back(new_ooh); | 31 | m->kids.push_back(new_ooh); |