On 2000/05/19, Jeff Breidenbach wrote:

> 5) I strongly suspect nmh is getting confused by all the newlines at the
>    end of the message. The matchc call on 445 is returning a number 
>    that is too large to be used.
> 
> 6) The comments say "If you hack on this and slow it down, I, my
>    children and my children's children will curse you."
> 
> 7) While the problem appears to be in matchc, the matchc code 
>    is nearly pure pointer arithmetic. Not the thing I want to casually
>    modify, lest I get cursed by someone's grandkids.

Thanks for your excellent analysis!

Actually, I had been working on the problem myself independently and had traced
it down to matchc as well, and I've come to the conclusion that matchc is
buggy.  It goes wrong when the first character of the pattern appears
repeatedly before the actual match.  In that case, even if the match crosses
the boundary of the string, a successful lookup is returned.  In this case,
your message ending in a couple of new lines (the first character of the
delimiter) triggered this bug.

Please change matchc as follows:

                while (pc != str++)
                        if (str > es)
                                return 0;
/* begin insert */
                if (str > es+1)
                        return 0;
/* end insert */
                sp = str; pp = pat;

As far as I can tell, this should fix the problem.  Please let me know if it
works or if it causes other problems.  If it works, I will incorporate it into
nmh (and take the risk of being cursed by Van Jacobson :-).

Thanks again for your help!

Ruud.
-- 
ruud de rooij | [EMAIL PROTECTED] | http://ruud.org

Reply via email to