summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2026-07-15 22:08:12 +0200
committerGitHub <noreply@github.com>2026-07-15 22:08:12 +0200
commit81402ca6aa93503be38736b5dd6d8d96fcbfd0d5 (patch)
tree13c6337658baf008a429dba9b4f622e64074d28f /Source/Core
parentfd8391a85241d1b359d662342c5c66f8f4b96d10 (diff)
parent900febec29bcfee8b7a1319ec74d9cb1bfb9d157 (diff)
Merge pull request #14732 from khang06/small-tmd-check
IOS/ES: Prevent reading TMDs that are too small
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IOS/ES/Formats.cpp2
-rw-r--r--Source/Core/Core/IOS/WFS/WFSI.cpp2
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp
index e055f72564..d041514171 100644
--- a/Source/Core/Core/IOS/ES/Formats.cpp
+++ b/Source/Core/Core/IOS/ES/Formats.cpp
@@ -194,7 +194,7 @@ void SignedBlobReader::DoState(PointerWrap& p)
bool IsValidTMDSize(size_t size)
{
- return size <= 0x49e4;
+ return size >= sizeof(TMDHeader) && size <= 0x49e4;
}
TMDReader::TMDReader(std::vector<u8> bytes) : SignedBlobReader(std::move(bytes))
diff --git a/Source/Core/Core/IOS/WFS/WFSI.cpp b/Source/Core/Core/IOS/WFS/WFSI.cpp
index c037967d6a..73bf030dea 100644
--- a/Source/Core/Core/IOS/WFS/WFSI.cpp
+++ b/Source/Core/Core/IOS/WFS/WFSI.cpp
@@ -156,7 +156,7 @@ std::optional<IPCReply> WFSIDevice::IOCtl(const IOCtlRequest& request)
if (!ES::IsValidTMDSize(tmd_size))
{
- ERROR_LOG_FMT(IOS_WFS, "IOCTL_WFSI_IMPORT_TITLE_INIT: TMD size too large ({})", tmd_size);
+ ERROR_LOG_FMT(IOS_WFS, "IOCTL_WFSI_IMPORT_TITLE_INIT: TMD size invalid ({})", tmd_size);
return_error_code = IPC_EINVAL;
break;
}
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index 39961a6c18..974592fea0 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -51,7 +51,7 @@ VolumeWAD::VolumeWAD(std::unique_ptr<BlobReader> reader) : m_reader(std::move(re
if (!IOS::ES::IsValidTMDSize(m_tmd_size))
{
- ERROR_LOG_FMT(DISCIO, "TMD is too large: {} bytes", m_tmd_size);
+ ERROR_LOG_FMT(DISCIO, "TMD has an invalid size: {} bytes", m_tmd_size);
return;
}