Fixed bug 2868 - SDL_FillRect can crash if surface's clip-rect is out-of-bounds
authorDavid Ludwig <dludwig@pobox.com>
Sun, 22 Feb 2015 20:34:08 -0500
changeset 9374b577c4753421
parent 9373 679eb3986e37
child 9375 bc00287b414f
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
     1.1 --- a/src/video/SDL_fillrect.c	Sun Feb 22 23:21:32 2015 +0100
     1.2 +++ b/src/video/SDL_fillrect.c	Sun Feb 22 20:34:08 2015 -0500
     1.3 @@ -251,6 +251,10 @@
     1.4          rect = &clipped;
     1.5      } else {
     1.6          rect = &dst->clip_rect;
     1.7 +        /* Don't attempt to fill if the surface's clip_rect is empty */
     1.8 +        if (SDL_RectEmpty(rect)) {
     1.9 +            return 0;
    1.10 +        }
    1.11      }
    1.12  
    1.13      /* Perform software fill */