From 3e7ba692056c2b9d0afbcb7e6e9ff6c80865c87a Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Mon, 16 Mar 2026 00:49:38 -0700 Subject: [PATCH] FifoPlayer: Fix hang when taking screenshot during FIFO log playback Don't copy null terminators from the log's `header.gameid` into `FifoDataFile`'s `m_game_id`. Doing so would cause an infinite loop in `Core::GenerateScreenshotName` as the various concatenations and `fmt::format` calls would then effectively drop all the timestamps and disambiguating arbitrary numbers since they followed the null terminator in the gameid, and so the `File::Exists` calls would always return true. Fixes https://bugs.dolphin-emu.org/issues/14002. --- Source/Core/Core/FifoPlayer/FifoDataFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp index 1e7ec5d77e..5c30081393 100644 --- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp +++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp @@ -274,7 +274,8 @@ std::unique_ptr FifoDataFile::Load(const std::string& filename, bo } else { - dataFile->m_game_id = std::string{header.gameid, DEFAULT_GAME_ID.size()}; + const size_t gameid_length = strnlen(header.gameid, DEFAULT_GAME_ID.size()); + dataFile->m_game_id = std::string{header.gameid, gameid_length}; } if (flagsOnly)