On 08/24/2010 01:38 AM, Jim Meyering wrote:
Paolo's concern about BEST_MATCH being *two* past end of buffer
is valid, but I've convinced myself that even if there is a malloc
implementation that returns a buffer whose final byte is in the last
available page, we'd be ok.  That is because of the way the buffer
size is chosen: adding page size + 1 ensures that an address 1 or 2
beyond end of buffer will refer to the same page as the last byte.

My concern is actually that malloc could return a buffer whose final byte is like 0xFFFFFFFE. x+buffer_size+1 would be valid, while x+buffer_size+2 would be NULL.

I agree this is not a practical problem (and easily worked around by mallocing one extra byte, anyway), but a comment would be nice.

Paolo

Reply via email to