| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug #706668 "regression: new PDF engine can't handle a broken PDF file, falsely reports password protected"
Although the file is damaged (in fact it appears to be 2 PDF files,
concatenated) that's not the problem. The second file is the one which
we process, and that file is encrypted. We simply were not setting the
encryption key length for Revision 3 and we were only reading the
actual key /Length if /V is present and has the value 2 or 3.
This is basically because PDF encryption is a mess, and simply an
oversight. Fix it here.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The revision 3 encryption code may have more than 40 bits, but it
need not have more.
Also the V entry in the encryption dictionary is optional for PDF
versions before 2.0.
Rework the code to cater for both these cases.
|
|
|
|
|
|
|
|
|
| |
The version 1 (/V 1) algorithm has a fixed key length of 40 bits, there
should not be a /Length key in the dictionary for this encryption but if
there is it should be 40.
Ignore /Length altogether for version 1 encryption algorithm to prevent
confusion with version 2.
|
|
|
|
|
|
|
|
|
|
|
| |
Bug #705307 "Output is an empty PDF"
An oversight, when We have an EncryptMetadata key in the Encrypt
dictionary, we end up with code = 1. If the V (Version) of the handler
is then <= 3 we return that, which incorrectly indicats the file is
not encrypted.
Just reset the value.
|
|
|
|
| |
No allocation/deallocation required.
|
|
|
|
|
| |
Use parentheses to make a test more explicitly obvious, hopefull this
will satisfy gcc.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were using the /Length value supplied in the Encrypt dictionary
even for encryption types where that is not valid. This commit
fixes the KeyLen value for those encryption types for which it is not
a variable (most of them), checks the minimum/maximum and multiple of 8
for the on really variable type, and flags warnings if the /Length is
supplied for an inappropriate filter.
It's possible we will see a load of files encrypted with V 3-6 which
supply a /Length where they technically shouldn't, and will raise a
warning. We might want to not do that in future if it proves irksome.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The file /tests_private/pdf/PDF_1.7_ATS/AC8ZD1CC_Save.pdf is an
encrypted file, using security handler version 4, PDF 1.5, where the
Encrypt dictionary has both the StmF and StrF filters set to /Identity.
This means the file is, in effect, not encrypted. Though technically it
is possible for a compressed object stream to specify a different
filter.
We were unable to create an object key because both filters were
Identity, leading to us failing to open the file. This commit will
continue in that case, and also will short-circuit a little of the
setup which is not required if the filter being used is Identity for
either streams or strings.
Previously the code worked correctly, it just went through some hoops
that we don't actually need to do, so this is (very) slightly more
efficient.
Ghostscript gives a warning about this case, but I've chosen not to here
as technically the file is entirely valid from that point of view (it
has many other problems). If anyone ever comlains we can add the
warning easily enough.
|
|
|
|
|
|
|
|
|
|
|
| |
If we repair the file (which can happen any time) it is possible that
ctx->Trailer might be replaced. If we are using it, and have not taken
a separate reference, then it could vanish while we are using it.
Since this isn't the first time this has come up, review and amend all
places using ctx->Trailer to use a temporary reference instead. Add
comments in each location and add comments to the definition in
ghostpdf.h to try and avoid a repetition.
|
|
|
|
|
| |
I'd forgotten to cater for the 'not found' case when checking the
encryption dictionary contents.
|
| |
|
|
This is a commit of the pdfi branch to master, eliminating
the traditional merge step.
The full history of the pdfi branch can be seen in the repo,
and that branch is effectively frozen from this point onwards.
This commit actually differs from pdfi in a small number of
whitespace changes (trailing spaces etc).
|