|
From: | Paolo Bonzini |
Subject: | Re: EGexecute: don't assume buffer ends in a newline |
Date: | Tue, 24 Aug 2010 12:00:56 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |