From 3c60d4a8869ff2f67ee067a119ccf56292af5264 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 16 Jan 2026 20:19:34 -0500 Subject: [PATCH] Fix 0 key length regression (Issue #149) --- pdfio-crypto.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pdfio-crypto.c b/pdfio-crypto.c index 0ae7527..61ce802 100644 --- a/pdfio-crypto.c +++ b/pdfio-crypto.c @@ -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);