CNFS offset problems

Russ Allbery rra at stanford.edu
Tue Jan 21 20:47:57 UTC 2003


bill davidsen <davidsen at tmr.com> writes:

>   If we write this as:
>     article.len > cnfs->length - cnfs->free - CNFS_BLOCKSIZE - 1
> the RHS can go negative, but if we write it as
>     (article.len + CNFS_BLOCKSIZE + 1) > (cnfs->length - cnfs->free)
> I think both side have to be positive and will happily compare. No
> comments about extra parens, people have to read code as well as
> compilers.

I almost did that, but then realized that this breaks for a 2GB article in
a particularly nasty way (article.len + CNFS_BLOCKSIZE + 1 overflows and
wraps to a small positive number, so CNFS thinks there's enough space for
the message).

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list