mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-11-23 03:09:55 +00:00
fixed checking for pkg size
This commit is contained in:
parent
3396b29136
commit
f82a37a0f3
@ -42,6 +42,16 @@ bool PKG::extract(const std::string& filepath, const std::string& extractPath, s
|
||||
PKGHeader pkgheader;
|
||||
file.ReadBE(pkgheader);
|
||||
|
||||
if (pkgheader.pkg_size > pkgSize)
|
||||
{
|
||||
failreason = "PKG file size is different";
|
||||
return false;
|
||||
}
|
||||
if ((pkgheader.pkg_content_size + pkgheader.pkg_content_offset) > pkgheader.pkg_size)
|
||||
{
|
||||
failreason = "Content size is bigger than pkg size";
|
||||
return false;
|
||||
}
|
||||
file.Seek(0, fsSeekSet);
|
||||
pkg = (U08*)mmap(pkgSize, file.fileDescr());
|
||||
|
||||
|
@ -71,6 +71,9 @@ inline void ReadBE(PKGHeader& s)
|
||||
ReadBE(s.magic);
|
||||
ReadBE(s.pkg_table_entry_offset);
|
||||
ReadBE(s.pkg_table_entry_count);
|
||||
ReadBE(s.pkg_content_offset);
|
||||
ReadBE(s.pkg_content_size);
|
||||
ReadBE(s.pkg_size);
|
||||
}
|
||||
|
||||
struct PKGEntry {
|
||||
|
Loading…
Reference in New Issue
Block a user