You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2021/05/18 07:32:52 UTC

svn commit: r1889986 - /spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm

Author: hege
Date: Tue May 18 07:32:52 2021
New Revision: 1889986

URL: http://svn.apache.org/viewvc?rev=1889986&view=rev
Log:
Minor optimizations

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=1889986&r1=1889985&r2=1889986&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Tue May 18 07:32:52 2021
@@ -2094,7 +2094,7 @@ sub compile_regexp {
 
   # paranoid check for eval exec (?{foo}), in case someone
   # actually put "use re 'eval'" somewhere..
-  if ($re =~ /\(\?\??\{/) {
+  if (index($re, '?{') >= 0 && $re =~ /\(\?\??\{/) {
     return (undef, 'eval (?{}) found');
   }
 
@@ -2104,7 +2104,7 @@ sub compile_regexp {
   if ($delim_end && $delim_end !~ tr/\}\)\]//) {
     # first we remove all escaped backslashes "\\"
     my $dbs_stripped = $re;
-    $dbs_stripped =~ s/\\\\//g;
+    $dbs_stripped =~ s/\\\\//g if index($dbs_stripped, '\\\\') >= 0;
     # now we can properly check if something is unescaped
     if ($dbs_stripped =~ /(?<!\\)\Q${delim_end}\E/) {
       return (undef, "unquoted delimiter '$delim_end' found");