Fix for ExecutionEngine buglet

Dale E. Martin dale at
Tue Nov 12 11:20:38 PST 2013

I have discovered a small bug in the ExecutionEngine.  A proposed fix is

There is a place in the ExecutionEngine where it is not resilient to a
failed allocation.  I believe the circumstances are:
* It is near the end of the buffer that has been allocated for code/data
* It is trying to allocate space for a large global, which is not
found in the globalAddressMap
* It tries to allocate it via "getMemoryForGV", but that fails after looking
at CurBufferPtr, so it returns NULL
* It does not check for a NULL return, and then it calls InitializeMemory
with a NULL destination which gets passed into memcpy
* It segvs before looking at CurBufferPtr to see if memory is exhausted and
retrying with more memory allocated

I don't know of a good way to unit test this but I have a repeatable
failure in some code I'm working on and this patch fixes it.

Let me know if you have more questions, comments, etc.

Dale E. Martin - dale at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ee.patch
Type: text/x-diff
Size: 755 bytes
Desc: not available
URL: <>

More information about the llvm-commits mailing list