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 <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2026-07-01 21:32:23 +02:00
parent 2bc674cbaa
commit 173d768087
No known key found for this signature in database

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2025 Wildfire Games. /* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -168,9 +168,9 @@ public:
*/ */
void SetRoundCoordinates(const bool RoundCoordinates); void SetRoundCoordinates(const bool RoundCoordinates);
private: private:
CStr m_SpriteName; CStr m_SpriteName{};
bool m_RoundCoordinates; bool m_RoundCoordinates{true};
// Stored drawing calls, for more efficient rendering // Stored drawing calls, for more efficient rendering
mutable GUIRenderer::DrawCalls m_DrawCallCache; mutable GUIRenderer::DrawCalls m_DrawCallCache;