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>
|
||||
|
||||
* Give warnings instead of segfaulting if a QPDF operation is
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <qpdf/FileInputSource.hh>
|
||||
#include <qpdf/BufferInputSource.hh>
|
||||
#include <qpdf/OffsetInputSource.hh>
|
||||
#include <qpdf/QPDFNameTreeObjectHelper.hh>
|
||||
|
||||
#include <qpdf/QPDFExc.hh>
|
||||
#include <qpdf/QPDF_Null.hh>
|
||||
@ -3004,22 +3005,17 @@ QPDF::findAttachmentStreams()
|
||||
{
|
||||
return;
|
||||
}
|
||||
QPDFObjectHandle embeddedFiles = names.getKey("/EmbeddedFiles");
|
||||
if (! embeddedFiles.isDictionary())
|
||||
QPDFObjectHandle embedded_files = names.getKey("/EmbeddedFiles");
|
||||
if (! embedded_files.isDictionary())
|
||||
{
|
||||
return;
|
||||
}
|
||||
names = embeddedFiles.getKey("/Names");
|
||||
if (! names.isArray())
|
||||
QPDFNameTreeObjectHelper ef_tree(embedded_files);
|
||||
auto ef_tree_map = ef_tree.getAsMap();
|
||||
for (auto& i: ef_tree_map)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < names.getArrayNItems(); ++i)
|
||||
{
|
||||
QPDFObjectHandle item = names.getArrayItem(i);
|
||||
QPDFObjectHandle item = i.second;
|
||||
if (item.isDictionary() &&
|
||||
item.getKey("/Type").isName() &&
|
||||
(item.getKey("/Type").getName() == "/Filespec") &&
|
||||
item.getKey("/EF").isDictionary() &&
|
||||
item.getKey("/EF").getKey("/F").isStream())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user