소스 검색

Fixed undefined behavior in QueueCmdSetDrawColor()

Fixes https://github.com/libsdl-org/SDL/issues/4995
Patch from Andrew Kelley
Ozkan Sezer 4 년 전
부모
커밋
e18be04bc6
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/render/SDL_render.c

+ 1 - 1
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)) {