Commit 9a1fad40773439a104c25606869e47011351fd90
1 parent
a42a4068
comments
Showing
1 changed file
with
15 additions
and
1 deletions
libqpdf/QPDF_encryption.cc
| ... | ... | @@ -472,6 +472,18 @@ QPDF::initializeEncryption() |
| 472 | 472 | } |
| 473 | 473 | if (this->cf_file != this->cf_stream) |
| 474 | 474 | { |
| 475 | + // The issue for qpdf is that it can't tell the difference | |
| 476 | + // between an embedded file stream and a regular stream. | |
| 477 | + // Search for a comment containing cf_file. To fix this, | |
| 478 | + // we need files with encrypted embedded files and | |
| 479 | + // non-encrypted native streams and vice versa. Also if | |
| 480 | + // it is possible for them to be encrypted in different | |
| 481 | + // ways, we should have some of those too. In cases where | |
| 482 | + // we can detect whether a stream is encrypted or not, we | |
| 483 | + // might want to try to detecet that automatically in | |
| 484 | + // defense of possible logic errors surrounding detection | |
| 485 | + // of embedded file streams, unless that's really clear | |
| 486 | + // from the specification. | |
| 475 | 487 | throw QPDFExc(qpdf_e_unsupported, this->file->getName(), |
| 476 | 488 | "encryption dictionary", this->file->getLastOffset(), |
| 477 | 489 | "This document has embedded files that are" |
| ... | ... | @@ -649,7 +661,9 @@ QPDF::decryptStream(Pipeline*& pipeline, int objid, int generation, |
| 649 | 661 | { |
| 650 | 662 | // NOTE: We should should use cf_file if this is an |
| 651 | 663 | // embedded file, but we can't yet detect embedded |
| 652 | - // file streams as such. | |
| 664 | + // file streams as such. When fixing, search for all | |
| 665 | + // occurrences of cf_file to find a reference to this | |
| 666 | + // comment. | |
| 653 | 667 | method = this->cf_stream; |
| 654 | 668 | } |
| 655 | 669 | } | ... | ... |