On Fri, 20 Jul 2018 18:51:33 -0500, Scott Cheloha wrote:

> The block sizes sum to 1 when cast and malloc(3) breaks us off a byte.
> read(2) then sees that it would be writing outside the valid address
> space and fails.

OK millert@ for the fix.

> Maybe pedantic, but should we also be checking for addition overflow?
> OpenBSD is fine -- those additions will not overflow, as we check prior to
> this point that all block sizes are <= SSIZE_MAX.  But the standard doesn't
> guarantee that SSIZE_MAX * 2 < SIZE_MAX.  Are such considerations left to
> the porter?

I think this is safe on any 2s-complement machine unless sizeof(ssize_t)
< sizeof(size_t).  I wouldn't worry about it.

 - todd

Reply via email to