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 2004/01/09 07:26:52 UTC

svn commit: rev 6132 - in incubator/spamassassin/trunk: lib/Mail/SpamAssassin rules

Author: jm
Date: Thu Jan  8 22:26:51 2004
New Revision: 6132

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
   incubator/spamassassin/trunk/rules/70_cvs_rules_under_test.cf
Log:
added test for tiny font sizes

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm	Thu Jan  8 22:26:51 2004
@@ -528,6 +528,8 @@
     }
   }
   if ($tag eq "font" && exists $attr->{size}) {
+    $self->{html}{tiny_font} = 1 if (($attr->{size} =~ /^\s*(\d+)/ && $1 < 1) ||
+			    ($attr->{size} =~ /\-(\d+)/ && $1 >= 3));
     $self->{html}{big_font} = 1 if (($attr->{size} =~ /^\s*(\d+)/ && $1 > 3) ||
 			    ($attr->{size} =~ /\+(\d+)/ && $1 >= 1));
   }
@@ -584,10 +586,7 @@
   }
   if (exists($attr->{style})) {
     if ($attr->{style} =~ /font(?:-size)?:\s*(\d+(?:\.\d*)?|\.\d+)(p[tx])/i) {
-      my $size = $1;
-      my $type = $2;
-
-      $self->{html}{big_font} = 1 if (lc($type) eq "pt" && $size > 12);
+      $self->examine_text_style ($1, $2);
     }
   }
   if ($tag eq "img" && exists $attr->{width} && exists $attr->{height}) {
@@ -675,6 +674,15 @@
   $self->{html}{anchor_text} ||= "" if ($tag eq "a");
 }
 
+sub examine_text_style {
+  my ($self, $size, $type) = @_;
+  $type = lc $type;
+  $self->{html}{tiny_font} = 1 if ($type eq "pt" && $size < 4);
+  $self->{html}{tiny_font} = 1 if ($type eq "pt" && $size < 4);
+  $self->{html}{big_font} = 1 if ($type eq "pt" && $size > 14);
+  $self->{html}{big_font} = 1 if ($type eq "px" && $size > 18);
+}
+
 sub html_text {
   my ($self, $text) = @_;
 
@@ -700,10 +708,7 @@
 
   if (exists $self->{html}{"inside_style"} && $self->{html}{"inside_style"} > 0) {
     if ($text =~ /font(?:-size)?:\s*(\d+(?:\.\d*)?|\.\d+)(p[tx])/i) {
-      my $size = $1;
-      my $type = $2;
-
-      $self->{html}{big_font} = 1 if (lc($type) eq "pt" && $size > 12);
+      $self->examine_text_style ($1, $2);
     }
     return;
   }
@@ -748,10 +753,7 @@
 
   if (exists $self->{html}{"inside_style"} && $self->{html}{"inside_style"} > 0) {
     if ($text =~ /font(?:-size)?:\s*(\d+(?:\.\d*)?|\.\d+)(p[tx])/i) {
-      my $size = $1;
-      my $type = $2;
-
-      $self->{html}{big_font} = 1 if (lc($type) eq "pt" && $size > 12);
+      $self->examine_text_style ($1, $2);
     }
   }
 

Modified: incubator/spamassassin/trunk/rules/70_cvs_rules_under_test.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/70_cvs_rules_under_test.cf	(original)
+++ incubator/spamassassin/trunk/rules/70_cvs_rules_under_test.cf	Thu Jan  8 22:26:51 2004
@@ -345,3 +345,7 @@
 header T_RE_UC_3WORDS	Subject =~ /^[rR][eE]: [A-Z]{3,12},(?:\s[A-Z][a-z]+){3}$/
 describe T_RE_UC_3WORDS	Has Subject in form "Re: UPPERCASE, word word word"
 
+# Spammers are now attempting to use tiny font sizes to hide hashbusters
+body T_HTML_FONT_TINY		eval:html_test('tiny_font')
+describe T_HTML_FONT_TINY	HTML has a tiny font
+