mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
LLVM: Fix nullptr deref when accessing broken cache files
This commit is contained in:
parent
a6b2bf69f1
commit
c556322fc5
1 changed files with 7 additions and 0 deletions
|
@ -388,6 +388,7 @@ public:
|
|||
|
||||
auto buf = llvm::WritableMemoryBuffer::getNewUninitMemBuffer(cached.size());
|
||||
cached.read(buf->getBufferStart(), buf->getBufferSize());
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -615,6 +616,12 @@ void jit_compiler::add(const std::string& path)
|
|||
{
|
||||
auto cache = ObjectCache::load(path);
|
||||
|
||||
if (!cache)
|
||||
{
|
||||
jit_log.error("ObjectCache: Failed to read file. (path='%s', error=%s)", path, fs::g_tls_error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto object_file = llvm::object::ObjectFile::createObjectFile(*cache))
|
||||
{
|
||||
m_engine->addObjectFile(llvm::object::OwningBinary<llvm::object::ObjectFile>(std::move(*object_file), std::move(cache)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue