mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
PPU LLVM: Add more MSELF file checks
Do not crash on invalid files.
This commit is contained in:
parent
08cf275bc8
commit
85884d14cd
1 changed files with 6 additions and 2 deletions
|
@ -3800,7 +3800,11 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
|
|||
|
||||
if (mself.read(rec) && rec.get_pos(mself.size()))
|
||||
{
|
||||
std::string name = rec.name;
|
||||
// Read characters safely
|
||||
std::string name(sizeof(rec.name), '\0');
|
||||
|
||||
std::memcpy(name.data(), rec.name, name.size());
|
||||
name = std::string(name.c_str());
|
||||
|
||||
upper = fmt::to_upper(name);
|
||||
|
||||
|
@ -3881,7 +3885,7 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
|
|||
if (u64 off = offset)
|
||||
{
|
||||
// Adjust offset for MSELF
|
||||
src = make_file_view(std::move(src), offset);
|
||||
src = make_file_view(std::move(src), offset, file_size);
|
||||
|
||||
// Adjust path for MSELF too
|
||||
fmt::append(path, "_x%x", off);
|
||||
|
|
Loading…
Add table
Reference in a new issue