Commit 841b4a09efc8b2fe2ceb0d517f97eb6a45b614ff
1 parent
7edafea8
Prevent infinite recursion in /AcroForm traversal by checking for self-referencing fields.
Showing
4 changed files
with
6 additions
and
1 deletions
fuzz/CMakeLists.txt
fuzz/qpdf_extra/5344352869351424.fuzz
0 → 100644
No preview for this file type
fuzz/qtest/fuzz.test
| ... | ... | @@ -11,7 +11,7 @@ my $td = new TestDriver('fuzz'); |
| 11 | 11 | |
| 12 | 12 | my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS"; |
| 13 | 13 | |
| 14 | -my $n_qpdf_files = 104; # increment when adding new files | |
| 14 | +my $n_qpdf_files = 105; # increment when adding new files | |
| 15 | 15 | |
| 16 | 16 | my @fuzzers = ( |
| 17 | 17 | ['ascii85' => 1], | ... | ... |
libqpdf/QPDFAcroFormDocumentHelper.cc
| ... | ... | @@ -328,6 +328,10 @@ QPDFAcroFormDocumentHelper::traverseField( |
| 328 | 328 | "ignoring field or annotation"); |
| 329 | 329 | return; |
| 330 | 330 | } |
| 331 | + if (field == parent) { | |
| 332 | + field.warn("loop detected while traversing /AcroForm"); | |
| 333 | + return; | |
| 334 | + } | |
| 331 | 335 | if (!field.isDictionary()) { |
| 332 | 336 | field.warn( |
| 333 | 337 | "encountered a non-dictionary as a field or annotation while traversing /AcroForm; " | ... | ... |