2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Merge pull request #1283 from m-holger/fuzz

Fix #1242
This commit is contained in:
m-holger 2024-09-17 00:19:52 +01:00 committed by GitHub
commit 61f7d97b20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 3 deletions

View File

@ -140,6 +140,7 @@ set(CORPUS_OTHER
70306.fuzz
70306a.fuzz
70306b.fuzz
71624.fuzz
)
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)

BIN
fuzz/qpdf_extra/71624.fuzz Normal file

Binary file not shown.

View File

@ -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 = 77; # increment when adding new files
my $n_qpdf_files = 78; # increment when adding new files
my @fuzzers = (
['ascii85' => 1],

View File

@ -676,7 +676,7 @@ class QPDF
// Traverse page tree return all /Page objects. It also detects and resolves cases in which the
// same /Page object is duplicated. For efficiency, this method returns a const reference to an
// internal vector of pages. Calls to addPage, addPageAt, and removePage safely update this, but
// directly manipulation of the pages tree or pushing inheritable objects to the page level may
// direct manipulation of the pages tree or pushing inheritable objects to the page level may
// invalidate it. See comments for updateAllPagesCache() for additional notes. Newer code should
// use QPDFPageDocumentHelper::getAllPages instead. The decision to expose this internal cache
// was arguably incorrect, but it is being left here for compatibility. It is, however,

View File

@ -71,7 +71,13 @@ QPDF::getAllPages()
throw QPDFExc(
qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
}
getAllPagesInternal(pages, visited, seen, false);
try {
getAllPagesInternal(pages, visited, seen, false);
} catch (...) {
m->all_pages.clear();
m->invalid_page_found = false;
throw;
}
if (m->invalid_page_found) {
flattenPagesTree();
m->invalid_page_found = false;