Commit e18be04bc6ae964beb175b5468595d640a100eec

Ozkan Sezer 2021-11-23T08:01:02

Fixed undefined behavior in QueueCmdSetDrawColor() Fixes https://github.com/libsdl-org/SDL/issues/4995 Patch from Andrew Kelley

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index cd8739d..c79d9ff 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -394,7 +394,7 @@ QueueCmdSetClipRect(SDL_Renderer *renderer)
 static int
 QueueCmdSetDrawColor(SDL_Renderer *renderer, SDL_Color *col)
 {
-    const Uint32 color = ((col->a << 24) | (col->r << 16) | (col->g << 8) | col->b);
+    const Uint32 color = (((Uint32)col->a << 24) | (col->r << 16) | (col->g << 8) | col->b);
     int retval = 0;
 
     if (!renderer->color_queued || (color != renderer->last_queued_color)) {