From ec76a4d56e3f83f7687e7d76c413c4dfb2d917ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 13 Oct 2026 10:05:35 +0200 Subject: [PATCH] GE dump playback: Refuse sections over 1 GB A zstd frame doesn't always declare its size, and a small one can expand to gigabytes, so this is the limit that keeps a crafted dump from exhausting memory. The largest section in the 1042-dump test set is 82 MB. Co-Authored-By: Claude Opus 5.5 --- GPU/Debugger/Playback.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GPU/Debugger/Playback.cpp b/GPU/Debugger/Playback.cpp index 7b681fc27f..71b63a77bd 100644 --- a/GPU/Debugger/Playback.cpp +++ b/GPU/Debugger/Playback.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -1235,8 +1234,12 @@ static bool ReadCompressed(u32 fp, u64 fileSize, std::vector &dest, u32 count return false; } + // Far beyond any real dump. A zstd frame doesn't always say how big it is, and a small one can + // expand to gigabytes, so this is what keeps a crafted one from exhausting memory. + const u64 MAX_SIZE = 1024 * 1024 * 1024; const u64 sz = (u64)count * sizeof(T); - if (sz > SIZE_MAX) { + if (sz > MAX_SIZE) { + ERROR_LOG(Log::GeDebugger, "GE dump section too large: %llu bytes", (unsigned long long)sz); return false; } else if (version < 5) { size_t declared = 0;