summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorDacoTaco <daco_65@hotmail.com>2026-05-13 20:26:47 +0200
committerDacoTaco <daco_65@hotmail.com>2026-05-13 20:46:20 +0200
commit21d44f32bad3a384396efafc612d74ef6f5eff8e (patch)
treedba100a9ee91ce03f657d58b420647af793f5a25 /Source/Core
parentd0d354fbed4999c1c7183d4593bab15601c3d5e9 (diff)
fixes: make dolreader validate section addresses and sizes
IOS and IPL reject non-32byte aligned sections
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Boot/DolReader.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/Core/Boot/DolReader.cpp b/Source/Core/Core/Boot/DolReader.cpp
index 0ec828c519..aa5f3dae0d 100644
--- a/Source/Core/Core/Boot/DolReader.cpp
+++ b/Source/Core/Core/Boot/DolReader.cpp
@@ -53,6 +53,14 @@ bool DolReader::Initialize(std::span<const u8> buffer)
{
if (m_dolheader.textSize[i] != 0)
{
+ if ((m_dolheader.textAddress[i] & 31) != 0 || (m_dolheader.textSize[i] & 31) != 0)
+ {
+ ERROR_LOG_FMT(BOOT,
+ "Text section {} is not 32-byte aligned: address = 0x{:08x}, size = 0x{:x}",
+ i, m_dolheader.textAddress[i], m_dolheader.textSize[i]);
+ return false;
+ }
+
if (buffer.size() < m_dolheader.textOffset[i] + m_dolheader.textSize[i])
return false;
@@ -80,6 +88,14 @@ bool DolReader::Initialize(std::span<const u8> buffer)
{
u32 section_size = m_dolheader.dataSize[i];
u32 section_offset = m_dolheader.dataOffset[i];
+ if ((m_dolheader.dataAddress[i] & 31) != 0 || (section_size & 31) != 0)
+ {
+ ERROR_LOG_FMT(BOOT,
+ "Data section {} is not 32-byte aligned: address = 0x{:08x}, size = 0x{:x}",
+ i, m_dolheader.dataAddress[i], section_size);
+ return false;
+ }
+
if (buffer.size() < section_offset)
return false;