Displaying 2 results from an estimated 2 matches for "shouldusemmap".
2016 Nov 17
2
UB in MemoryBufferMMapFile
...alloc’d buffer that is one byte larger, and put a zero there.
This doesn't seem to be working correctly, unless
sys::Process::getPageSize() is returning the wrong thing for me.
I'm getting here from getOpenFileImpl() in MemoryBuffer.cpp, which is
deciding it's safe to mmap (by calling shouldUseMMap, where the page
size check you mention is). The file is 561152 bytes, and the page
size reports 16384, so this is not a multiple of page size (0x89000 &
0x3fff == 0x1000). Yet, the memory one byte past the mmap is not
readable.
>> There are three options here:
>>
>> 1. Remov...
2016 Nov 17
3
UB in MemoryBufferMMapFile
In MemoryBuffer::init, we have an assert that reads the memory at
`BufEnd`, which is one past the end of some memory region:
from lib/Support/MemoryBuffer.cpp:45:
> void MemoryBuffer::init(const char *BufStart, const char *BufEnd,
> bool RequiresNullTerminator) {
> assert((!RequiresNullTerminator || BufEnd[0] == 0) &&
> "Buffer is not