summaryrefslogtreecommitdiff
path: root/Resource
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2020-12-15 16:46:56 +0000
committerKen Sharp <ken.sharp@artifex.com>2020-12-15 16:46:56 +0000
commite1dfb92cc593cd27ed593ffcc3a79711b7504563 (patch)
treecce31d30b47ba67f793814dbc7540279a3bbc671 /Resource
parent4d91c6ad3e76e19f36d23a50dce253fbbc7d0560 (diff)
downloadghostpdl-e1dfb92cc593cd27ed593ffcc3a79711b7504563.tar.gz
PDF interpreter - handle indirect objects in Encrypt dictionary
Bug #703272 "This PDF files converts to tiff using the oitsample program, but the font turns from English to what looks like chinese" The Encrypt dictionary and the subsidiary StdCF dictionary are stored as indirect objects (presumably in order to make the file larger). The decryption code wasn't expecting that. Add code to dereference the objects. While we're here, add code to check the types of the objects and ensure they are correct, and throw an error if they are not.
Diffstat (limited to 'Resource')
-rw-r--r--Resource/Init/pdf_sec.ps32
1 files changed, 25 insertions, 7 deletions
diff --git a/Resource/Init/pdf_sec.ps b/Resource/Init/pdf_sec.ps
index b6f2bfce5..b4361b8da 100644
--- a/Resource/Init/pdf_sec.ps
+++ b/Resource/Init/pdf_sec.ps
@@ -481,15 +481,33 @@ systemdict /check_r6_password .forceundef
% Even if StmF and StrF are Identity, if the StdCF is missing AuthEvent
% or it is DocOpen, we require the password. Check for that.
1 index /CF .knownget {
- /StdCF .knownget {
- /AuthEvent .knownget {
- /DocOpen eq
- or
+ oforce dup type /dicttype eq {
+ /StdCF .knownget {
+ oforce dup type /dicttype eq {
+ /AuthEvent .knownget {
+ oforce dup type /nametype eq {
+ /DocOpen eq
+ or
+ }{
+ ( **** Error: AuthEvent has wrong type.\n) pdfformaterror
+ ( Cannot decrypt PDF file.\n) pdfformaterror
+ /pdf_process_Encrypt cvx /invalidfileaccess signalerror
+ } ifelse
+ } {
+ pop true % no AuthEvent, default is DocOpen, require password
+ } ifelse
+ }{
+ ( **** Error: StdCF has wrong type.\n) pdfformaterror
+ ( Cannot decrypt PDF file.\n) pdfformaterror
+ /pdf_process_Encrypt cvx /invalidfileaccess signalerror
+ } ifelse
} {
- pop true % no AuthEvent, default is DocOpen, require password
+ pop true % no StdCF, require password
} ifelse
- } {
- pop true % no StdCF, require password
+ }{
+ ( **** Error: CF has wrong type.\n) pdfformaterror
+ ( Cannot decrypt PDF file.\n) pdfformaterror
+ /pdf_process_Encrypt cvx /invalidfileaccess signalerror
} ifelse
} {
pop true % no CF, require password