Fix 0 key length regression (Issue #149)

This commit is contained in:
Michael R Sweet
2026-01-16 20:19:50 -05:00
parent a16a3130f8
commit a9210c114a

View File

@@ -693,6 +693,11 @@ _pdfioCryptoUnlock(
_pdfioFileError(pdf, "Unsupported encryption V%d R%d.", version, revision);
return (false);
}
else if (length < 40 || length > 128)
{
_pdfioFileError(pdf, "Unsupported key length %d.", length);
return (false);
}
// Grab the remaining values we need to unlock the PDF...
pdf->file_keylen = (size_t)(length / 8);