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/08/20 00:07:22 UTC

svn commit: r567486 - /spamassassin/trunk/sa-compile.raw

Author: jm
Date: Sun Aug 19 15:07:21 2007
New Revision: 567486

URL: http://svn.apache.org/viewvc?rev=567486&view=rev
Log:
bug 5493: sa-compile would not correctly deal with escaped backslashes, fix

Modified:
    spamassassin/trunk/sa-compile.raw

Modified: spamassassin/trunk/sa-compile.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-compile.raw?rev=567486&r1=567485&r2=567486&view=diff
==============================================================================
--- spamassassin/trunk/sa-compile.raw (original)
+++ spamassassin/trunk/sa-compile.raw Sun Aug 19 15:07:21 2007
@@ -69,6 +69,7 @@
 
 # testing purposes only
 my $fixup_re_test;
+#$fixup_re_test = 1; fixup_re("fr()|\\\\|"); die;
 #$fixup_re_test = 1; fixup_re("\\x{1b}\$b"); die;
 #$fixup_re_test = 1; fixup_re("\\33\$b"); die;
 #$fixup_re_test = 1; fixup_re("[link]"); die;
@@ -620,6 +621,8 @@
       my $esc = $1;
       if ($esc eq '"') {
         $output .= '"\\""';
+      } elsif ($esc eq '\\') {
+        $output .= '"**BACKSLASH**"';   # avoid hairy escape-parsing
       } elsif ($esc =~ /^x\{(\S+)\}$/) {
         $output .= '"'.chr(hex($1)).'"';
       } elsif ($esc =~ /^\d+/) {
@@ -644,6 +647,7 @@
   $output =~ s/^""/"/;  # protect start and end quotes
   $output =~ s/(?<!\\)""$/"/;
   $output =~ s/(?<!\\)""//g; # strip empty strings, or turn "abc""def" -> "abcdef"
+  $output =~ s/\*\*BACKSLASH\*\*/\\\\/gs;
 
   $fixup_re_test and print "OUTPUT: $output\n";
   return $output;