Compare commits

..
Author SHA1 Message Date
OatmealDome 596d71fbba ScmRevGen: Bump version to 2606a 2026-08-10 18:06:46 -04:00
OatmealDome 94b20d52f0 BuildMacOSUniversalBinary: Add flag to enable CCache 2026-08-10 17:50:28 -04:00
JosJuiceandOatmealDome 6376e0c1f1 IOS/FS: Fix loading savestate when files are open
We already had code to close open host files when reading or writing a
savestate, but due to d35fe1b we also need to close open guest files
when reading a savestate, otherwise DoStateRead fails to delete them.

I was considering an alternative solution where instead of copying and
clearing m_handles, we just set `handle.opened = false;` for each handle
before reading a savestate (but not before writing a savestate).
However, this wouldn't solve the problem of DoStateWriteOrMeasure's
calls to OpenFile failing due to all handles being open. I'm not aware
of any games that have that many handles open, though.
2026-08-10 17:50:28 -04:00
Acts1631andOatmealDome f29ed945d0 Core: log invalid ELF input
Log each rejected ELF header, range, and symbol reference. This
provides actionable diagnostics for malformed files without changing the
validation behavior.
2026-08-10 17:50:27 -04:00
Acts1631andOatmealDome 7c4ed02b27 Core: validate standalone ELF input ranges
ElfReader trusted table offsets and counts from standalone ELF files.
Malformed input could make it read and write past the loaded file buffer.

Validate the ELF header, table ranges, segment data, section data, and
string-table references before accessing them. Invalid files use the
existing executable boot failure path.
2026-08-10 17:50:27 -04:00
Acts1631andOatmealDome a926974153 NetPlay: bound LZO decompression output
NetPlay save synchronization decoded remote LZO blocks with the unsafe
decoder and no output capacity. A malicious host could overflow a client
buffer with a block larger than its declared size.

Use the bounds-checking decoder, validate the declared output length, and
grow buffer results only after each checked block has been decoded.
2026-08-10 17:50:27 -04:00
Scott MansellandOatmealDome 5e237fd284 DolReader: Fix integer wraparound
A malicious dol could theoretically use integer wraparound to bypass
bounds checking and cause DolReader to read past the end of m_bytes.

Could result in crashes, wasting large amounts of memory, or even the
disclosure of heap memory contents.
2026-08-10 17:50:27 -04:00
DacoTacoandOatmealDome 611d864897 fixes: make dolreader validate section addresses and sizes
IOS and IPL reject non-32byte aligned sections
2026-08-10 17:50:27 -04:00
Scott MansellandOatmealDome b6d8da24b3 GCZ: use 64-bit for m_data_offset
A malicious GCZ file could probably force this to be negative.
Shouldn't cause any issues other than file read failures, but need to fix
because it is causing errors on MSVC.
2026-08-10 17:50:27 -04:00
Scott MansellandOatmealDome 4eb90c7314 GCZ: validate while loading 2026-08-10 17:50:26 -04:00
Scott MansellandOatmealDome 8f1e33a5f4 GCZ: Don't trust block_num either
SectorReader::ReadChunk does do some validation on it, but it only
checks against the original disc size (reported by the GCZ file).
It has no idea how many blocks the header claimed the disc had.

A maliciously crafted GCZ file could trigger read overflows off the end
of the m_block_pointers/m_hashes arrays.
2026-08-10 17:50:26 -04:00
Scott MansellandOatmealDome 2f5232fbf4 GCZ: Don't trust GetBlockCompressedSize
It comes unverified from the file, and a maliciously crafted file could
trigger not one, but two buffer overflows in the heap.
2026-08-10 17:50:26 -04:00
Admiral H. CurtissandOatmealDome b6282fb9ab IOS/NetIPTopDevice: Zero-initialize sockaddr structs
Fixes https://github.com/dolphin-emu/dolphin/security/advisories/GHSA-5fqv-9qrg-gm4j
2026-08-10 17:50:26 -04:00
Tillmann KarrasandOatmealDome 5aa711db41 DSPHLE/Zelda: prevent out-of-bounds stack read
Reported by @RickdeJager.
2026-08-10 17:50:26 -04:00
Admiral H. CurtissandOatmealDome 6d2e3a1ecc HW/DSPHLE/AXVoice: Prefer BitCastPtr over BitCastToArray in ApplyUpdatesForMs() 2026-08-10 17:50:26 -04:00
Admiral H. CurtissandOatmealDome b2c4d543dd HW/DSPHLE/AXVoice: Check array bounds in ApplyUpdatesForMs()
Fixes https://github.com/dolphin-emu/dolphin/security/advisories/GHSA-4q28-hhjv-hf3f
2026-08-10 17:50:26 -04:00
+3 -10
View File
@@ -1468,16 +1468,9 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb)
// the end of processing, if needed.
//
// Maximum of 0x500 samples here - see NeededRawSamplesCount to understand
// this practical limit (resampling_ratio = 0xFFFF -> 0x500 samples).
//
// If current_pos_frac contains an (invalid) non-fractional part, it can push
// this up by another 15 samples. Which DownloadAFCSamplesFromARAM then rounds
// up to the next multiple of 16. So add an extra 0x10 samples to be safe.
//
// Plus we need an extra four samples at the start to hold the last four
// samples from the previous frame.
std::array<s16, 4 + 0x500 + 0x10> raw_input_samples;
// this practical limit (resampling_ratio = 0xFFFF -> 0x500 samples). Add a
// margin of 4 that is needed for samples source that do resampling.
std::array<s16, 0x500 + 4> raw_input_samples;
for (size_t i = 0; i < 4; ++i)
raw_input_samples[i] = vpb->resample_buffer[i];