From ea61be5ebeeae165f32c93eb912bac551fa9414c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 17 Dec 2018 23:56:01 +0100 Subject: [PATCH] Prevent logging from using already-freed game command (#8473) gc variable is held by reference in the scope above, pointing to the queue's beginning. --- src/openrct2/network/Network.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index d1549c9b68..23155c498a 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -1885,12 +1885,12 @@ void Network::ProcessGameCommands() { // Having old command from a tick where we have not been active yet or malicious server, // the command is useless so lets not keep it. - game_command_queue.erase(game_command_queue.begin()); - log_warning( "Discarding game command from tick behind current tick, CMD: %08X, CMD Tick: %08X, Current Tick: %08X\n", gc.esi, gc.tick, gCurrentTicks); + game_command_queue.erase(game_command_queue.begin()); + // At this point we should not return, would add the possibility to skip commands this tick. continue; }