I helped a developer using SB API yesterday who had a bug and tried to read 0xffffffffffffffe8 with SBProcess::ReadMemory. swig would try to malloc a buffer for that, which would fail but was not checked, and hand the nullptr to ReadMemory. lldb would continue on until it tried to copy bytes into the nullptr and crash.
Fixing the script was obvious, but having lldb crash out from under the script made it a little harder to debug. I think we should check for a null buffer at the SBProcess API point and return an error there.
Added a quick test to the ProcessAPI test. This call will cause a huge malloc which should safely fail on every platform I think? We may need to revise if this ends up crashing lldb on some target I guess.
Nit: this isn't using bytes_read so I'd move the new code above it.