Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: SpamAssassin: devel

[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars

 

 

First page Previous page 1 2 Next page Last page  View All SpamAssassin devel RSS feed   Index | Next | Previous | View Threaded


bugzilla-daemon at bugzilla

Jul 2, 2009, 3:13 AM

Post #1 of 36 (1597 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143


Justin Mason <jm [at] jmason> changed:

What |Removed |Added
----------------------------------------------------------------------------
Summary|Various messages are |Rule2XSBody segfaults due
|causing spamassassin to |to rule containing NUL
|segfault. |chars




--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 2, 2009, 11:13 AM

Post #2 of 36 (1556 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #8 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-02 11:13:46 PST ---
I've been trying to reproduce this on a non-production server, with the same
versions of code. It's not crashing. The scanner.re file also has a different
pattern:
" {RET("__SEEK_1R0JFS");}
" {RET("__SEEK_1R0JFS __SEEK_VWPOF8");}

for the recreate, I downloaded the most recent SOUGHT rules,
updates.spamassassin.org, and created a specific rule in /etc/mail/spamassassin

are the original channel definitions available so I can try that instead.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 2, 2009, 3:05 PM

Post #3 of 36 (1561 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #9 from Justin Mason <jm [at] jmason> 2009-07-02 15:05:04 PST ---
(In reply to comment #8)
> I've been trying to reproduce this on a non-production server, with the same
> versions of code. It's not crashing. The scanner.re file also has a different
> pattern:
> " {RET("__SEEK_1R0JFS");}
> " {RET("__SEEK_1R0JFS __SEEK_VWPOF8");}
>
> for the recreate, I downloaded the most recent SOUGHT rules,
> updates.spamassassin.org, and created a specific rule in /etc/mail/spamassassin
>
> are the original channel definitions available so I can try that instead.

http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/jm/20_sought.cf?revision=789373

or other versions from the list at
http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/jm/20_sought.cf?view=log
.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 2, 2009, 4:04 PM

Post #4 of 36 (1558 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #10 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-02 16:04:09 PST ---
(In reply to comment #9)
>
> http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/jm/20_sought.cf?revision=789373
>
> or other versions from the list at
> http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/jm/20_sought.cf?view=log
> .

Unfortunately, it is not reproducing for me off-line. I really don't want to
mess with our production spam filters.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 3, 2009, 2:17 AM

Post #5 of 36 (1542 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #11 from Justin Mason <jm [at] jmason> 2009-07-03 02:17:41 PST ---
can you install a copy of SA in your home dir on the production system (using
"perl Makefile.PL PREFIX=$HOME/testsa") and reproduce it with that? that might
work....

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 5:56 AM

Post #6 of 36 (1480 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #12 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-06 05:56:38 PST ---
Ok, I installed it in my home directory, and now I have a test system I can
seg-fault at will.

The line from scanner1.re is:
"^@" {RET("__SEEK_1R0JFS");}

when I run spamassassin -D, the last few lines are:
[5320] dbg: zoom: run_body_fast_scan for body_0 start
[5320] dbg: rules: ran one_line_body rule __FB_PICK ======> got hit: "pick"
[5320] dbg: rules: ran one_line_body rule __DOS_BODY_SUN ======> got hit:
"Sunday"
[5320] dbg: rules: ran one_line_body rule __FB_PICK ======> got hit: "pick"
Segmentation fault (core dumped)


What other things would you like me to do with this system?

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 6:28 AM

Post #7 of 36 (1477 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #13 from Justin Mason <jm [at] jmason> 2009-07-06 06:28:32 PST ---
(In reply to comment #12)
> What other things would you like me to do with this system?

could you run "sa-compile --debug --keep-tmps", then tar up a copy of the
stdout/stderr output, and the temporary directory it creates, and attach them
here? (or mail them to me if it's too big)

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 7:18 AM

Post #8 of 36 (1474 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #14 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-06 07:18:33 PST ---
Created an attachment (id=4473)
--> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4473)
tmp directory and output from sa-compile --debug --keep-tmps

The debug statements didn't come through with | tee I'll try again.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 7:29 AM

Post #9 of 36 (1473 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #15 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-06 07:29:10 PST ---
Created an attachment (id=4474)
--> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4474)
debug output collected properly this time.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 3:50 PM

Post #10 of 36 (1467 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143


Justin Mason <jm [at] jmason> changed:

What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal




--- Comment #16 from Justin Mason <jm [at] jmason> 2009-07-06 15:50:05 PST ---
thanks for that. I can now do this:

cd tmp/.spamassassin5004X1lz2qtmp/Mail-SpamAssassin-CompiledRegexps-body_0
make clean
perl Makefile.PL
make
dd if=/dev/zero of=o bs=1 count=1

perl -w -Iblib/lib -Iblib/arch -e '
use Mail::SpamAssassin::CompiledRegexps::body_0;
print @{Mail::SpamAssassin::CompiledRegexps::body_0::scan(<>)}' < o

result: one segmentation fault, reproducing the bug on my Ubuntu box here.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7d128d0 (LWP 9797)]
Mail_SpamAssassin_CompiledRegexps_body_0_scan1 (p=0xbfd2c2c8) at
scanner1.c:21
21 yych = *YYCURSOR;
(gdb) bt
#0 Mail_SpamAssassin_CompiledRegexps_body_0_scan1 (p=0xbfd2c2c8) at
scanner1.c:21
#1 0xb7c7059e in XS_Mail__SpamAssassin__CompiledRegexps__body_0_scan
(my_perl=0x9b4a008,
cv=0x9bea6e8) at body_0.xs:83
#2 0x080b3c92 in Perl_pp_entersub ()
#3 0x080b2069 in Perl_runops_standard ()
#4 0x080b04d0 in perl_run ()
#5 0x08063ebd in main ()

here's the thing -- remove -O2 and it works fine. So it's a compiler
optimization bug, I think.

-O2: fails
-O: fails
-g: ok
-g -O: fails

none of the other gcc switches affect it; just -O / -O2.

I'm tempted to just close this as WORKSFORME, but maybe we should try to get
sa-compile to avoid compiling rules that contain NUL bytes?

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 5:26 PM

Post #11 of 36 (1466 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #17 from Sidney Markowitz <sidney [at] sidney> 2009-07-06 17:26:45 PST ---
The bug appears to be scanner1.c on line 182

As it is written, passing in a NUL causes it to use an uninitialized variable q
in q the return (YYMARKER is #defined to be q)

Changing the line from
++YYCURSOR;
to
YYMARKER = ++YYCURSOR;

makes the segfault go away and looks at my first glance to be the right thing
to do there, but I don't really know the code, I don't know what scanner1.c is
part of or even if it is written by a human or automatically generated (it
doesn't read very human to me).

Can someone take this from there as I don't have time to follow up on it?

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 9:09 PM

Post #12 of 36 (1455 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #18 from Sidney Markowitz <sidney [at] sidney> 2009-07-06 21:09:04 PST ---
Created an attachment (id=4476)
--> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4476)
patch for sa-compile.raw in trunk that may fix this

As far as I can tell the bug is in sa-compile and will appear with any
one-character rule pattern and has nothing to do with a NUL character.

I think this patch is the correct fix. It is a one-liner in sa-compile.raw in
trunk that also applies ok to branch 3.2, which initializes the variable q so
that the backtrack goes to the start of the input if it never is advanced
during the scan.

I don't know how to run sa-compile on just a few rules to test this easily.
Please apply the patch and see if it fixes the problem.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 6, 2009, 11:33 PM

Post #13 of 36 (1452 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #19 from Sidney Markowitz <sidney [at] sidney> 2009-07-06 23:33:29 PST ---
Committed to trunk revision 791715 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=791715 ).

I looked over the examples in re2c enough to satisfy myself that this is the
correct fix, at least enough to commit it to trunk.

I still would like feedback on how it works with the problem rule, especially
confirmation that the rule hits correctly as well as not segfaulting, before
closing this bug.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 1:47 AM

Post #14 of 36 (1449 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #20 from Justin Mason <jm [at] jmason> 2009-07-07 01:47:36 PST ---
(In reply to comment #19)
> Committed to trunk revision 791715 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=791715 ).
>
> I looked over the examples in re2c enough to satisfy myself that this is the
> correct fix, at least enough to commit it to trunk.

thanks Sidney! good catch. I'll take a look at this later, but that sounds
promising...

I wonder why the -O presence affected it, and gcc didn't warn about it?

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 2:39 AM

Post #15 of 36 (1450 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #21 from Sidney Markowitz <sidney [at] sidney> 2009-07-07 02:39:09 PST ---
(in reply to comment #20)

gcc -Wall does warn about the uninitialized variable, which was part of how I
tracked it down. As for the -O, it's to be expected that an uninitialized
pointer variable would produce different unpredictable results with different
code generating options, and I guess this one just happened to work out this
way.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 5:17 AM

Post #16 of 36 (1443 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #22 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-07 05:17:19 PST ---
applying the patch to sa-compile does eliminate the segfault. I have debug
output and --keep-tmps if anyone would like to see it.

Thanks Sidney!

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 11:03 AM

Post #17 of 36 (1441 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #23 from Sidney Markowitz <sidney [at] sidney> 2009-07-07 11:03:27 PST ---
(in reply to comment #22)

Daniel, as the one remaining thing before I close the bug as fixed, to be
thorough, could you please confirm that the rule does match the test message
correctly, i.e., hits the same in its sa--compiled form as in its perl form? It
would not do much good to avoid a segfault if it is not working as a rule.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 11:22 AM

Post #18 of 36 (1442 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #24 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-07 11:22:33 PST ---
I tried it before and I thought it worked, but now I get:
$ usr/bin/spamassassin < mail.txt
Out of memory!

Last few lines of debug text are:
[31784] dbg: rules: running meta tests; score so far=4
[31784] dbg: rules: compiled meta tests
[31784] dbg: check: running tests for priority: 0
[31784] dbg: rules: running one_line_body tests; score so far=4
[31784] dbg: rules: compiled one_line_body tests
[31784] dbg: zoom: run_body_fast_scan for body_0 start
[31784] dbg: rules: ran one_line_body rule __FB_PICK ======> got hit: "pick"
[31784] dbg: rules: ran one_line_body rule __DOS_BODY_SUN ======> got hit:
"Sunday"
[31784] dbg: rules: ran one_line_body rule __FB_PICK ======> got hit: "pick"
Out of memory!
[mcdonalddj [at] c ~

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 12:05 PM

Post #19 of 36 (1440 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #25 from Sidney Markowitz <sidney [at] sidney> 2009-07-07 12:05:52 PST ---
(in reply to comment #24)

Sigh. How is the code in scanner1.c different now from when it segfaulted?

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 12:46 PM

Post #20 of 36 (1436 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #26 from Daniel J McDonald <dan.mcdonald [at] austinenergy> 2009-07-07 12:46:27 PST ---
(In reply to comment #25)
> (in reply to comment #24)
>
> Sigh. How is the code in scanner1.c different now from when it segfaulted?

diff -u
/tmp/.spamassassin19043yy3FjMtmp/Mail-SpamAssassin-CompiledRegexps-body_0/scanner1.c
/tmp/.spamassassin5004X1lz2qtmp/Mail-SpamAssassin-CompiledRegexps-body_0/scanner1.c
---
/tmp/.spamassassin19043yy3FjMtmp/Mail-SpamAssassin-CompiledRegexps-body_0/scanner1.c
2009-07-07 07:12:47.000000000 -0500
+++
/tmp/.spamassassin5004X1lz2qtmp/Mail-SpamAssassin-CompiledRegexps-body_0/scanner1.c
2009-07-06 07:43:09.000000000 -0500
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.12.0 on Tue Jul 7 07:12:47 2009 */
+/* Generated by re2c 0.12.0 on Mon Jul 6 07:43:09 2009 */
#define NULL ((char*) 0)
#define YYCTYPE unsigned char
#define YYCURSOR *p
@@ -10,7 +10,7 @@
allow "abcdef" to return both "abc" and "cde" as tokens */
#define RET(x) { YYCURSOR = YYMARKER; return (x); }
char *Mail_SpamAssassin_CompiledRegexps_body_0_scan1(unsigned char **p){
-unsigned char *q = *p;
+unsigned char *q;
{

{

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 5:06 PM

Post #21 of 36 (1440 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #27 from Sidney Markowitz <sidney [at] sidney> 2009-07-07 17:06:56 PST ---
I think I see the problem now, but not yet the solution.

The generated in code in scanner1.c looks like the following (in your example.
FWIW, it shows up in scanner2.re and scanner2.c when using a newer version of
re2c, but still has the same problem)

++YYCURSOR;
{RET("__SEEK_1R0JFS");}

where RET is #defined to start with

YYCURSOR = YYMARKER;

Clearly that doesn't make sense, which would be ok for generated code if all it
meant was that the ++YYCURSOR is an extra operation that does nothing. The
problem is that if YYMARKER points to the start of the buffer that was passed
in, the loop that is calling this loops forever waiting for YYCURSOR to be
advanced to the end of the buffer.

while (cursor < pend) { [... call this function passing it &cursor] }

I need to think through exactly how YYMARKER and the RET macro are supposed to
make the overlapped backtracking thing work out. As it stands now, any single
character match string will cause this to happen, but some other wrong thing
may happen in some other circumstances because I see at least one other place
where a ++YCURSOR; comes right before a RET.

Oh, I just got an insight as to why the __SEEK_1R0JFS rule is involved even
though as far as I can tell that rule does not match on just a single NUL
character. I bet that it is because it does contain NUL characters in its match
string and there is also the NUL_IN_BODY rule, and it is the combination of the
two that leads the re2c compiler to produce this code. What I think is going on
is that the backtracking is supposed to let the scanner match on the single NUL
character for NUL_IN_BODY, then backtrack and continue matching __SEEK_1R0JFS
which includes that NUL character.

Does anyone know how the the rule2xs scanner is supposed to handle two rules
that match on the same string? So far I haven't seen how that can be done.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 8:15 PM

Post #22 of 36 (1435 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #28 from Sidney Markowitz <sidney [at] sidney> 2009-07-07 20:15:13 PST ---
Can anyone explain how the __SEEK_1R0JFS rule compiles into something that
matches a single NUL character? I'm looking at the code and it doesn't have to
do with backtracking. The scanner1.re file contains patterns to match on, and
__SEEK_1R0JFS has a pattern of just "^@" which is nothing like the long pattern
in 20_sought.cf.

Does anyone know enough about how sa-compile works to explain how the
scanner*.re files are generated and what decides what patterns to put in them?
The fact that it says "^@" for the pattern for the rule has got to be a bug.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 7, 2009, 10:22 PM

Post #23 of 36 (1431 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #29 from Sidney Markowitz <sidney [at] sidney> 2009-07-07 22:22:41 PST ---
Ok, this is very weird.

It appears that BodyRuleBaseExtractor.pm stops when it hits \x{00} when it is
extracting a base_string from the original string of the pattern if there is a
\x{80} through \x{ff} character anywhere in the pattern, either before or after
the \x{00}.

You can see this by creating a rule, for example I put it in local.cf in the
update directory, run sa-compile --list, then in the sa-compile output look for
the rule name, first with the "orig" label which shows the original pattern,
then the "r" label which shows the base string that is extracted from it. If
you make the pattern a simple string with no regexp operators, e.g.
/FOO\x{00}BAR/ you will see that the "r" listing has /foo\x{0}bar/. But put
\x{ff} or \x{80} anywhere in the pattern and the "r" listing shows the pattern
truncated just before the \x{00}.

I haven't pored through the code in BodyRuleBaseExtractor.pm to figure out why
it does it, and I'm not sure if I'll have time to, so if someone more familiar
with that code can look at it, that would be great.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 8, 2009, 12:49 AM

Post #24 of 36 (1417 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #30 from Sidney Markowitz <sidney [at] sidney> 2009-07-08 00:49:31 PST ---
The string appears to get munged somewhere in sub extract_hints where all the
patterns are written out to a temporary file then executed as perl code to get
some debugging output that is then processed. I'm going to try to control
myself from looking at that code and hope that whoever wrote it ia paying
attention to this bug :-)

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


bugzilla-daemon at bugzilla

Jul 8, 2009, 1:49 AM

Post #25 of 36 (1426 views)
Permalink
[Bug 6143] Rule2XSBody segfaults due to rule containing NUL chars [In reply to]

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6143





--- Comment #31 from Sidney Markowitz <sidney [at] sidney> 2009-07-08 01:49:03 PST ---
perl does not seem to be doing what the code expects it to be doing.

perl -c -Mre=debug -e 'use bytes; m/foo\x{00}ba\x{7f}r/'

has the output that extract_hints expects, containing the line

1: EXACT <foo\x{0}ba\x{7f}r>(4)

But with anything >= \x{80} it does not.

perl -c -Mre=debug -e 'use bytes; m/foo\x{00}ba\x{80}r/'

instead has the line

1: EXACT <foo>(4)

I don't know the fix for this, as I don't yet understand what this code is
about.

--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

First page Previous page 1 2 Next page Last page  View All SpamAssassin devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.