1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-23 08:38:06 +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");