[lldb-dev] malloc of 1 used as 8
ck at remobjects.com
Mon Mar 4 10:55:49 PST 2013
In IRInterpreter.cpp, memory class there's this code:
Region Malloc (size_t size, size_t align)
lldb::DataBufferSP data(new lldb_private::DataBufferHeap(size, 0));
m_memory.push_back(AllocationSP(new Allocation(base, size, data)));
AllocationSP alloc = m_memory[index];
alloc->m_origin.GetScalar() = (unsigned long long)data->GetBytes();
This last statement presumes that that there's at least sizeof(unsigned
long long), but this code also gets triggered for booleans (1 byte), in
which case size is 1.
lldb::DataBufferSP data(new lldb_private::DataBufferHeap(size < 8 ? 8 :
But I'm not sure if it's the right fix.
Visual Studio freaks out when things write outside the bounds that were
More information about the lldb-dev