You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2011/05/09 02:34:03 UTC
svn commit: r1100849 -
/spamassassin/branches/3.3/lib/Mail/SpamAssassin/HTML.pm
Author: mmartinec
Date: Mon May 9 00:34:02 2011
New Revision: 1100849
URL: http://svn.apache.org/viewvc?rev=1100849&view=rev
Log:
Bug 6468: splice() offset past end of array in HTML.pm
Modified:
spamassassin/branches/3.3/lib/Mail/SpamAssassin/HTML.pm
Modified: spamassassin/branches/3.3/lib/Mail/SpamAssassin/HTML.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.3/lib/Mail/SpamAssassin/HTML.pm?rev=1100849&r1=1100848&r2=1100849&view=diff
==============================================================================
--- spamassassin/branches/3.3/lib/Mail/SpamAssassin/HTML.pm (original)
+++ spamassassin/branches/3.3/lib/Mail/SpamAssassin/HTML.pm Mon May 9 00:34:02 2011
@@ -489,17 +489,9 @@ sub text_style {
if ($value =~ /rgb/) {
$value =~ tr/0-9,//cd;
my @rgb = split(/,/, $value);
- splice @rgb, 3;
- for(my $i=0; $i<3; $i++) {
- if (!defined $rgb[$i]) {
- $_ = 0;
- }
- elsif ($rgb[$i] > 255) {
- $rgb[$i] = 255;
- }
- }
-
- $new{$whcolor} = sprintf("#%02x%02x%02x", @rgb);
+ $new{$whcolor} = sprintf("#%02x%02x%02x",
+ map { !$_ ? 0 : $_ > 255 ? 255 : $_ }
+ @rgb[0..2]);
}
else {
$new{$whcolor} = name_to_rgb($value);