summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2026-07-22 03:21:19 +0200
committerOatmealDome <julian@oatmealdome.me>2026-08-10 17:50:26 -0400
commitb2c4d543dd87e5344516d212ee29d256caa2adf1 (patch)
tree791c65f1abaab4368de93387f0c47bd6801403bb /Source/Core
parent6094cfcf7b8fba733b3116fdf3414d51c1c0e4a4 (diff)
HW/DSPHLE/AXVoice: Check array bounds in ApplyUpdatesForMs()
Fixes https://github.com/dolphin-emu/dolphin/security/advisories/GHSA-4q28-hhjv-hf3f
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h
index 54531a85f6..1655e28074 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h
@@ -65,12 +65,21 @@ void ApplyUpdatesForMs(int curr_ms, PB_TYPE& pb, u16* num_updates, const PBUpdat
for (int i = 0; i < curr_ms; ++i)
start_idx += num_updates[i];
- for (u32 i = start_idx; i < start_idx + num_updates[curr_ms]; ++i)
+ if (start_idx < updates.size())
{
- u16 update_off = updates[i].pb_offset;
- u16 update_val = updates[i].new_value;
+ const u16 count = num_updates[curr_ms];
+ if (count <= updates.size() - start_idx)
+ {
+ const u32 end_idx = start_idx + count;
+ for (u32 i = start_idx; i < end_idx; ++i)
+ {
+ const u16 update_off = updates[i].pb_offset;
+ const u16 update_val = updates[i].new_value;
- pb_mem[update_off] = update_val;
+ if (update_off < pb_mem.size())
+ pb_mem[update_off] = update_val;
+ }
+ }
}
pb = std::bit_cast<PB_TYPE>(pb_mem);