You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fk...@apache.org on 2026/09/18 16:42:41 UTC

svn commit: r1938348 - in spamassassin/trunk: lib/Mail/SpamAssassin/PDF/Filter t

Author: fkento
Date: Fri Sep 18 16:42:41 2026
New Revision: 1938348

Log:
Bug 8412: Fix warning in pdf handler if Crypt::RC4 is not installed

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/PDF/Filter/Decrypt.pm
   spamassassin/trunk/t/pdf_info.t

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PDF/Filter/Decrypt.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PDF/Filter/Decrypt.pm	Fri Sep 18 15:35:57 2026	(r1938347)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PDF/Filter/Decrypt.pm	Fri Sep 18 16:42:41 2026	(r1938348)
@@ -39,10 +39,13 @@ sub new {
         die "Encryption algorithm $v not implemented";
     }
 
-    # All supported encryption variants need RC4; V4/V5 (AES) also need
+    # V1/V2/V4 encryption variants need RC4; V5 is exclusively AES-256 (R5/R6)
+    # and never calls Crypt::RC4::RC4 anywhere in this module.  V4/V5 also need
     # Crypt::Mode::CBC, and R5/R6 need Digest::SHA.  Bail out clearly if a
     # required crypto module is missing rather than failing deep in decryption.
-    die "Crypt::RC4 module not available\n" unless HAS_CRYPT_RC4;
+    if ( $v == 1 || $v == 2 || $v == 4 ) {
+        die "Crypt::RC4 module not available\n" unless HAS_CRYPT_RC4;
+    }
     if ( $v == 4 || $v == 5 ) {
         die "Crypt::Mode::CBC module not available\n" unless HAS_CRYPT_MODE_CBC;
         die "Digest::SHA module not available\n" unless HAS_DIGEST_SHA;

Modified: spamassassin/trunk/t/pdf_info.t
==============================================================================
--- spamassassin/trunk/t/pdf_info.t	Fri Sep 18 15:35:57 2026	(r1938347)
+++ spamassassin/trunk/t/pdf_info.t	Fri Sep 18 16:42:41 2026	(r1938348)
@@ -92,7 +92,7 @@ my @tests = (
     },
     {
         filename => 'data/pdf/aesv3.pdf',
-        requires => ['Crypt::RC4', 'Crypt::Mode::CBC', 'Digest::SHA'],
+        requires => ['Crypt::Mode::CBC', 'Digest::SHA'],
         expected => {
             'ClickArea' => 852, 'ClickRatio' => '0.18',
             'CreationDate' => 'D:20260624044120Z00\'00\'', 'Creator' => 'Pages',
@@ -122,7 +122,7 @@ my @tests = (
     },
     {
         filename => 'data/pdf/protected.pdf',
-        requires => ['Crypt::RC4', 'Crypt::Mode::CBC', 'Digest::SHA'],
+        requires => ['Crypt::Mode::CBC', 'Digest::SHA'],
         expected => {
             'ClickArea' => 0, 'Encrypted' => 1,
             'ImageArea' => 0, 'ImageCount' => 0, 'JavaScript' => 0,