mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-27 06:21:02 +00:00
PPU LLVM: fix crash on damaged cache files
This commit is contained in:
parent
91d80aa7b9
commit
6c8d844ec5
@ -965,6 +965,11 @@ public:
|
||||
std::vector<uchar> gz = cached.to_vector<uchar>();
|
||||
std::vector<uchar> out;
|
||||
z_stream zs{};
|
||||
|
||||
if (gz.empty()) [[unlikely]]
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
#ifndef _MSC_VER
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
@ -1015,6 +1020,11 @@ public:
|
||||
|
||||
if (fs::file cached{path, fs::read})
|
||||
{
|
||||
if (cached.size() == 0) [[unlikely]]
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto buf = llvm::WritableMemoryBuffer::getNewUninitMemBuffer(cached.size());
|
||||
cached.read(buf->getBufferStart(), buf->getBufferSize());
|
||||
return buf;
|
||||
@ -1208,6 +1218,11 @@ bool jit_compiler::check(const std::string& path)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (fs::remove_file(path))
|
||||
{
|
||||
jit_log.error("ObjectCache: Removed damaged file: %s", path);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user