mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Treat /EmbeddedFiles as a proper name tree
If we ever had an encrypted file with different filters for attachments and either the /EmbeddedFiles name tree was deep or some of the file specs didn't have /Type, we would have overlooked those as attachment streams. The code now properly handles /EmbeddedFiles as a name tree.
This commit is contained in:
parent
6fe7b704c7
commit
fc88837d4b
@ -1,3 +1,9 @@
|
|||||||
|
2021-01-11 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
|
* Fix very old error in code that was finding attachment streams.
|
||||||
|
Probably this error never mattered, but the code was still not
|
||||||
|
exactly right.
|
||||||
|
|
||||||
2021-01-06 Jay Berkenbilt <ejb@ql.org>
|
2021-01-06 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
* Give warnings instead of segfaulting if a QPDF operation is
|
* Give warnings instead of segfaulting if a QPDF operation is
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <qpdf/FileInputSource.hh>
|
#include <qpdf/FileInputSource.hh>
|
||||||
#include <qpdf/BufferInputSource.hh>
|
#include <qpdf/BufferInputSource.hh>
|
||||||
#include <qpdf/OffsetInputSource.hh>
|
#include <qpdf/OffsetInputSource.hh>
|
||||||
|
#include <qpdf/QPDFNameTreeObjectHelper.hh>
|
||||||
|
|
||||||
#include <qpdf/QPDFExc.hh>
|
#include <qpdf/QPDFExc.hh>
|
||||||
#include <qpdf/QPDF_Null.hh>
|
#include <qpdf/QPDF_Null.hh>
|
||||||
@ -3004,22 +3005,17 @@ QPDF::findAttachmentStreams()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QPDFObjectHandle embeddedFiles = names.getKey("/EmbeddedFiles");
|
QPDFObjectHandle embedded_files = names.getKey("/EmbeddedFiles");
|
||||||
if (! embeddedFiles.isDictionary())
|
if (! embedded_files.isDictionary())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
names = embeddedFiles.getKey("/Names");
|
QPDFNameTreeObjectHelper ef_tree(embedded_files);
|
||||||
if (! names.isArray())
|
auto ef_tree_map = ef_tree.getAsMap();
|
||||||
|
for (auto& i: ef_tree_map)
|
||||||
{
|
{
|
||||||
return;
|
QPDFObjectHandle item = i.second;
|
||||||
}
|
|
||||||
for (int i = 0; i < names.getArrayNItems(); ++i)
|
|
||||||
{
|
|
||||||
QPDFObjectHandle item = names.getArrayItem(i);
|
|
||||||
if (item.isDictionary() &&
|
if (item.isDictionary() &&
|
||||||
item.getKey("/Type").isName() &&
|
|
||||||
(item.getKey("/Type").getName() == "/Filespec") &&
|
|
||||||
item.getKey("/EF").isDictionary() &&
|
item.getKey("/EF").isDictionary() &&
|
||||||
item.getKey("/EF").getKey("/F").isStream())
|
item.getKey("/EF").getKey("/F").isStream())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user