interesting problem

David Relson relson at osagesoftware.com
Sun Nov 7 23:17:39 CET 2004


Hi,

Today I encountered some puzzling results.  Sometimes "make check" would
pass all 39 tests and other times it would fail 7 of the tests --
t.split, t.lexer.mbx, etc, i.e. those involving message parsing.

As a first step, I found that the problem occurs in my debug builds but
not in production builds.  The difference is whether the "-O2" optimizer
flag is present in CFLAGS (in Makefile ).  (Note: For debugging I remove
the "-O2" because that makes gdb much happier).   This hadn't been a
problem in the past, but today it was.  Ultimately I found that during
mime boundary checking (in mime.c) the length/index variable can go
negative.  The problem is now fixed in CVS.

For those of you who are interested, I've attached "tst.head.sh", a test
script.  It demonstrates the problem when run in bogofilter's "src"
directory.  "patch.1107.mime.c" corrects the problem and is also
attached.

AFAICT, the lexer works fine with the usual "-O2" optimizations and
fails with optimization disabled.  Usually, optimization causes
problems, rather than cures them.  Go figger!

David

Note:  the CVS tree has been patched, so this fix will be in 0.93.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst.head.sh
Type: application/x-sh
Size: 258 bytes
Desc: not available
URL: <https://www.bogofilter.org/pipermail/bogofilter-dev/attachments/20041107/3456f83b/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.1107.mime.c
Type: application/octet-stream
Size: 954 bytes
Desc: not available
URL: <https://www.bogofilter.org/pipermail/bogofilter-dev/attachments/20041107/3456f83b/attachment.obj>


More information about the bogofilter-dev mailing list