From 3a5fc9931a6fe767fc78a834961c38720fa10848 Mon Sep 17 00:00:00 2001 From: Acts1631 Date: Tue, 6 Oct 2026 21:24:17 -0400 Subject: [PATCH] Validate FIFO sizes when loading save states StateWrapper trusted serialized FIFO lengths and passed them to FIFOQueue::PushRange. Oversized values could write beyond the queue's fixed storage when loading local or netplay states. Reject lengths above the queue capacity before allocating or copying, mark the state load failed, and clear the destination queue. --- src/common/state_wrapper.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/state_wrapper.h b/src/common/state_wrapper.h index d572303f..d190df50 100644 --- a/src/common/state_wrapper.h +++ b/src/common/state_wrapper.h @@ -150,6 +150,13 @@ public: if (m_mode == Mode::Read) { + if (m_error || size > CAPACITY) + { + m_error = true; + data->Clear(); + return; + } + T* temp = new T[size]; DoArray(temp, size); data->Clear();