From 173d768087537f7dfbc4f9c7085a153f2b6a0c73 Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Wed, 1 Jul 2026 21:32:23 +0200 Subject: [PATCH] Fix UB in GUISprite Draw Using the no args constructor m_RoundCoordinates doesn't get initialized, meaning the memory can contain whatever. We were lucky in that in most cases random means true. Signed-off-by: Ralph Sennhauser --- source/gui/CGUISprite.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/gui/CGUISprite.h b/source/gui/CGUISprite.h index d93566fcf6..e0972597ec 100644 --- a/source/gui/CGUISprite.h +++ b/source/gui/CGUISprite.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -168,9 +168,9 @@ public: */ void SetRoundCoordinates(const bool RoundCoordinates); private: - CStr m_SpriteName; + CStr m_SpriteName{}; - bool m_RoundCoordinates; + bool m_RoundCoordinates{true}; // Stored drawing calls, for more efficient rendering mutable GUIRenderer::DrawCalls m_DrawCallCache;