You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/09/19 14:20:17 UTC

svn commit: r577272 - /spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm

Author: jm
Date: Wed Sep 19 05:20:16 2007
New Revision: 577272

URL: http://svn.apache.org/viewvc?rev=577272&view=rev
Log:
avoid massive memory blow-up in sa-compile; seems /\b/ isn't the right thing to use when matching the list of already-subsumed base string names

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm?rev=577272&r1=577271&r2=577272&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm Wed Sep 19 05:20:16 2007
@@ -321,17 +321,19 @@
       # skip if either already contains the other rule's name
       # optimize: this can only happen if the base has more than
       # one rule already attached, ie [5]
-      next if ($set1->[5] && $name1 =~ /\b\Q$name2\E\b/);
-      next if ($set2->[5] && $name2 =~ /\b\Q$name1\E\b/);
+      next if ($set2->[5] && $name2 =~ /(?: |^)\Q$name1\E(?: |$)/);
+
+      # don't use $name1 here, since another base in the set2 loop
+      # may have added $name2 since we set that
+      next if ($set1->[5] && $set1->[1] =~ /(?: |^)\Q$name2\E(?: |$)/);
 
       # and finally check to see if it *does* contain the other base string
       next if ($base1 !~ $set2->[4]);
 
+      # base2 is just a subset of base1
+      dbg("zoom: subsuming '$base2' ($name2) into '$base1': [1]=$set1->[1] [5]=$set1->[5]");
       $set1->[1] .= " ".$name2;
       $set1->[5] = 1;
-
-      # base2 is just a subset of base1
-      # dbg("zoom: subsuming '$base2' into '$base1': $set1->[1]");
     }
   }