Set the terminate handler to std::abort. (#12541)
Cast malloc to wchar_t. This is required in C++.

https://github.com/ariya/phantomjs/issues/12543
https://github.com/ariya/phantomjs/issues/12236