1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Merge pull request #19555 from rossj/master

Pad rev 4 encryption keys to be >= 16 bytes (issue 19484)
This commit is contained in:
Jonas Jenwald 2025-02-25 10:03:56 +01:00 committed by GitHub
commit aa70b28365
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 1 deletions

View file

@ -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");

View file

@ -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

Binary file not shown.

BIN
test/pdfs/issue19484_2.pdf Normal file

Binary file not shown.

View file

@ -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",