2
1
mirror of https://github.com/qpdf/qpdf.git synced 2025-01-02 22:50:20 +00:00

Merge pull request #1240 from m-holger/i1238

Fix QPDFOutlineDocumentHelper::resolveNamedDest  (fixes #1238)
This commit is contained in:
m-holger 2024-07-18 22:24:16 +01:00 committed by GitHub
commit 9ac506509b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 1605 additions and 17 deletions

View File

@ -1,6 +1,12 @@
2024-07-14 M Holger <m.holger@qpdf.org>
* Bug fix: handle named destinations where the entry is a
dictionary with /D entry instead of an explicit destination.
Fixes #1238.
2024-07-04 M Holger <m.holger@qpdf.org>
* Treat corrupt JPEG streams as unfilterable. This avoids them
* Treat corrupt JPEG streams as unfilterable. This avoids them
getting uncompressed when writing PDF files with decode level all.
2024-07-02 Jay Berkenbilt <ejb@ql.org>
@ -24,12 +30,12 @@
2024-06-29 M Holger <m.holger@qpdf.org>
* Bug fix: in QPDFOutlineObjectHelper detect loops in the list of
* Bug fix: in QPDFOutlineObjectHelper detect loops in the list of
direct children of an outline item.
2024-06-27 M Holger <m.holger@qpdf.org>
* Add sanity check in QPDF xref table reconstruction to reject
* Add sanity check in QPDF xref table reconstruction to reject
objects with impossibly large object id in order to improve
handling of severely damaged PDF files.

View File

@ -68,30 +68,29 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
QPDFObjectHandle result;
if (name.isName()) {
if (!m->dest_dict.isInitialized()) {
m->dest_dict = this->qpdf.getRoot().getKey("/Dests");
}
if (m->dest_dict.isDictionary()) {
QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest");
result = m->dest_dict.getKey(name.getName());
m->dest_dict = qpdf.getRoot().getKey("/Dests");
}
QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest");
result= m->dest_dict.getKeyIfDict(name.getName());
} else if (name.isString()) {
if (nullptr == m->names_dest) {
QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names");
if (names.isDictionary()) {
QPDFObjectHandle dests = names.getKey("/Dests");
if (dests.isDictionary()) {
m->names_dest = std::make_shared<QPDFNameTreeObjectHelper>(dests, this->qpdf);
}
if (!m->names_dest) {
auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
if (dests.isDictionary()) {
m->names_dest = std::make_shared<QPDFNameTreeObjectHelper>(dests, qpdf);
}
}
if (m->names_dest.get()) {
if (m->names_dest) {
if (m->names_dest->findObject(name.getUTF8Value(), result)) {
QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
}
}
}
if (!result.isInitialized()) {
result = QPDFObjectHandle::newNull();
return QPDFObjectHandle::newNull();
}
if (result.isDictionary()) {
QTC::TC("qpdf", "QPDFOutlineDocumentHelper named dest dictionary");
return result.getKey("/D");
}
return result;
}

View File

@ -356,6 +356,7 @@ QPDFOutlineObjectHelper action dest 0
QPDFOutlineObjectHelper named dest 0
QPDFOutlineDocumentHelper name named dest 0
QPDFOutlineDocumentHelper string named dest 0
QPDFOutlineDocumentHelper named dest dictionary 0
QPDFOutlineObjectHelper loop 0
QPDFObjectHandle merge top type mismatch 0
QPDFObjectHandle merge shallow copy 0

View File

@ -18,6 +18,7 @@ my @outline_files = (
'page-labels-and-outlines',
'outlines-with-actions',
'outlines-with-old-root-dests',
'outlines-with-old-root-dests-dict',
'outlines-with-loop',
);
my $n_tests = scalar(@outline_files);

View File

@ -0,0 +1,12 @@
page 0: •Merschqaberschq (A) 1.2.2 -> 0: /XYZ null null null -> [ 6 0 R /XYZ null null null ]
page 1: •Gabeebeebee (name) 1.2.1 -> 1: /FitR 66 714 180 770 -> [ 7 0 R /FitR 66 714 180 770 ]
page 5: •Potato 1 -> 5: /XYZ null null null -> [ 11 0 R /XYZ null null null ]
page 11: •Mern 1.1 -> 11: /Fit -> [ 17 0 R /Fit ]
page 12: •Biherbadem 1.1.1 -> 12: /FitV 100 -> [ 18 0 R /FitV 100 ]
page 12: •Gawehwehweh 1.1.2 -> 12: /XYZ null null null -> [ 18 0 R /XYZ null null null ]
page 13: •Squash ÷πʬ÷ 1.2 -> 13: /FitH 792 -> [ 19 0 R /FitH 792 ]
page 15: •Salad 2 -> 15: /XYZ 66 756 3 -> [ 21 0 R /XYZ 66 756 3 ]
page 18: •Glarpenspliel (A, name) 1.1.1.1 -> 18: /XYZ null null null -> [ 24 0 R /XYZ null null null ]
page 19: •Hagoogamagoogle 1.1.1.2 -> 19: /XYZ null null null -> [ 25 0 R /XYZ null null null ]
page 22: •Jawarnianbvarwash 1.1.2.1 -> 22: /XYZ null null null -> [ 28 0 R /XYZ null null null ]
test 49 done

File diff suppressed because it is too large Load Diff