summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-12-28 07:15:29 +0100
committerLiam <byteslice@airmail.cc>2023-12-28 07:16:51 +0100
commitd1c99c5d5290de8be60af340bbb79d41e92dac8f (patch)
tree345dc11addc306b52b7923df03aff363b25c9fc5 /src
parentMerge pull request #12455 from liamwhite/end-wait (diff)
downloadyuzu-d1c99c5d5290de8be60af340bbb79d41e92dac8f.tar
yuzu-d1c99c5d5290de8be60af340bbb79d41e92dac8f.tar.gz
yuzu-d1c99c5d5290de8be60af340bbb79d41e92dac8f.tar.bz2
yuzu-d1c99c5d5290de8be60af340bbb79d41e92dac8f.tar.lz
yuzu-d1c99c5d5290de8be60af340bbb79d41e92dac8f.tar.xz
yuzu-d1c99c5d5290de8be60af340bbb79d41e92dac8f.tar.zst
yuzu-d1c99c5d5290de8be60af340bbb79d41e92dac8f.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/ips_layer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/file_sys/ips_layer.cpp b/src/core/file_sys/ips_layer.cpp
index 7be1322cc..31033634c 100644
--- a/src/core/file_sys/ips_layer.cpp
+++ b/src/core/file_sys/ips_layer.cpp
@@ -73,6 +73,9 @@ VirtualFile PatchIPS(const VirtualFile& in, const VirtualFile& ips) {
return nullptr;
auto in_data = in->ReadAllBytes();
+ if (in_data.size() == 0) {
+ return nullptr;
+ }
std::vector<u8> temp(type == IPSFileType::IPS ? 3 : 4);
u64 offset = 5; // After header
@@ -88,6 +91,10 @@ VirtualFile PatchIPS(const VirtualFile& in, const VirtualFile& ips) {
else
real_offset = (temp[0] << 16) | (temp[1] << 8) | temp[2];
+ if (real_offset > in_data.size()) {
+ return nullptr;
+ }
+
u16 data_size{};
if (ips->ReadObject(&data_size, offset) != sizeof(u16))
return nullptr;