mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Fix decryption of R=4, V=4 files with < 16-byte keys by 0-padding - undocumented but matches Acrobat behavior (issue #19484)
This commit is contained in:
parent
fef706233d
commit
4f25d7f6cd
5 changed files with 26 additions and 1 deletions
|
@ -1787,7 +1787,14 @@ class CipherTransformFactory {
|
|||
);
|
||||
}
|
||||
|
||||
this.encryptionKey = encryptionKey;
|
||||
if (algorithm === 4 && encryptionKey.length < 16) {
|
||||
// Extend key to 16 byte minimum (undocumented),
|
||||
// fixes issue19484_1.pdf and issue19484_2.pdf.
|
||||
this.encryptionKey = new Uint8Array(16);
|
||||
this.encryptionKey.set(encryptionKey);
|
||||
} else {
|
||||
this.encryptionKey = encryptionKey;
|
||||
}
|
||||
|
||||
if (algorithm >= 4) {
|
||||
const cf = dict.get("CF");
|
||||
|
|
2
test/pdfs/.gitignore
vendored
2
test/pdfs/.gitignore
vendored
|
@ -106,6 +106,7 @@
|
|||
!issue9084.pdf
|
||||
!issue12963.pdf
|
||||
!issue9105_reduced.pdf
|
||||
!issue19484_2.pdf
|
||||
!issue9105_other.pdf
|
||||
!issue9252.pdf
|
||||
!issue9262_reduced.pdf
|
||||
|
@ -481,6 +482,7 @@
|
|||
!openoffice.pdf
|
||||
!js-buttons.pdf
|
||||
!issue7014.pdf
|
||||
!issue19484_1.pdf
|
||||
!issue8187.pdf
|
||||
!annotation-link-text-popup.pdf
|
||||
!issue9278.pdf
|
||||
|
|
BIN
test/pdfs/issue19484_1.pdf
Normal file
BIN
test/pdfs/issue19484_1.pdf
Normal file
Binary file not shown.
BIN
test/pdfs/issue19484_2.pdf
Normal file
BIN
test/pdfs/issue19484_2.pdf
Normal file
Binary file not shown.
|
@ -3629,6 +3629,14 @@
|
|||
"link": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"id": "issue19484_1",
|
||||
"file": "pdfs/issue19484_1.pdf",
|
||||
"md5": "4e9e78a84226dbdddbd735388ccc2dcd",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue5644",
|
||||
"file": "pdfs/issue5644.pdf",
|
||||
|
@ -5043,6 +5051,14 @@
|
|||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue19484_2",
|
||||
"file": "pdfs/issue19484_2.pdf",
|
||||
"md5": "cd3050eda9fa18a7e6a78c702f9890bb",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "bug894572",
|
||||
"file": "pdfs/bug894572.pdf",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue