From d6c429665390ec2cfb78b4d2597e22b1602876f2 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Sun, 22 Feb 2015 20:34:08 -0500 Subject: [PATCH] Fixed bug 2868 - SDL_FillRect can crash if surface's clip-rect is out-of-bounds Thanks to John Skaller for the research into this, and for the fix! --- src/video/SDL_fillrect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c index 5f343eaf26dc2..84707842e15eb 100644 --- a/src/video/SDL_fillrect.c +++ b/src/video/SDL_fillrect.c @@ -251,6 +251,10 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color) rect = &clipped; } else { rect = &dst->clip_rect; + /* Don't attempt to fill if the surface's clip_rect is empty */ + if (SDL_RectEmpty(rect)) { + return 0; + } } /* Perform software fill */