1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-23 08:38:06 +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:
Ross Johnson 2025-02-24 12:52:08 -06:00
parent fef706233d
commit 4f25d7f6cd
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");