From 20dadf1713424f157232b9aa4988ef05df751aaa Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 24 Dec 2024 15:35:30 +0900 Subject: pdf: fix PDF encryption and re-enable the test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Slightly wrong loop exit condition when calculating the R6 hash, which caused that every now and then the document could not be decrypted correctly. This happened at least 1 time in 100 tries (usually it did not even take that much to encountered a test failure), but with the fix it worked correctly for 500 tries, so it seems this issue is now fixed. Change-Id: I5fa046892f36dabc367aabed1295802e805ee6e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179299 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/source/pdf/PDFEncryptorR6.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl/source') diff --git a/vcl/source/pdf/PDFEncryptorR6.cxx b/vcl/source/pdf/PDFEncryptorR6.cxx index 52dceddc9636..6363ace090a8 100644 --- a/vcl/source/pdf/PDFEncryptorR6.cxx +++ b/vcl/source/pdf/PDFEncryptorR6.cxx @@ -235,7 +235,7 @@ std::vector computeHashR6(const sal_uInt8* pPassword, size_t nPasswor } // Step e) and f) // We stop iteration if we do at least 64 rounds and (the last element of E <= round number - 32) - while (nRound < 64 || E.back() > (nRound - 32)); + while (nRound <= 64 || E.back() > (nRound - 32)); // Output - first 32 bytes return std::vector(K.begin(), K.begin() + 32); -- cgit