buffer swapping....Lots of progress.

David Relson relson at osagesoftware.com
Tue Feb 25 17:09:27 CET 2003


At 10:42 AM 2/25/03, Nick Simicich wrote:
>I *think* This change needs to be made:
>
>    while (msg_header
>            && count != -1
>            && memcmp(buf,spam_header_name,hdrlen) == 0)
>     {
>
>count should change to >= hdrlen ---- else this will compare leftover 
>buffer contents.

I'll add checks for count > 5.  The current code is incorrect, but hasn't 
caused any trouble.  However, it _is_ incorrect.

>in lexer.c, I think that count should be >= 5 here.
>
>   if (count > 0
>         && memcmp("From ", buf, 5) != 0
>This instead?
>         && ((count >= 5 && memcmp("From ", buf, 5) != 0) || count < 5)
>         && !msg_header && !msg_state->mime_header
>         && msg_state->mime_type != MIME_TYPE_UNKNOWN) {
>         int decoded_count = mime_decode(buf, count);
>         /*change buffer size only if the decoding worked */
>         if (decoded_count != 0)
>             count = decoded_count;
>     }
>
>
>I think I got it working...at least the buffer swaps are working and I am 
>not stepping all over the buffers. It was as simple, once I knew what was 
>going on, as delaying the buffer swap until *after* the call to yylex.  I 
>moved my swap induction code to get_token, right after the while(true) 
>{.  All the basic tests work.  But all the advanced tests fail:

I'll build a version with your new code and look at why the tests fail.  As 
has been mentioned before _any_ change to the lexer that generates a 
different sequence of tokens has a high probability of causing tests to 
fail.  They are very sensitive to changes.  Since they _are_ regression 
tests, the sensitivity is good.

Cheers!

David






More information about the bogofilter-dev mailing list