Don't crash if we are asked to convert a surface to a NULl buffer.
authorSam Lantinga <slouken@libsdl.org>
Mon, 25 Feb 2013 00:54:25 -0800
changeset 6920a966229b4107
parent 6919 c9c75d062fa8
child 6921 9a29af9de577
Don't crash if we are asked to convert a surface to a NULl buffer.
src/video/SDL_surface.c
     1.1 --- a/src/video/SDL_surface.c	Mon Feb 25 01:51:21 2013 -0500
     1.2 +++ b/src/video/SDL_surface.c	Mon Feb 25 00:54:25 2013 -0800
     1.3 @@ -935,6 +935,16 @@
     1.4      SDL_Rect rect;
     1.5      void *nonconst_src = (void *) src;
     1.6  
     1.7 +    /* Check to make sure we are bliting somewhere, so we don't crash */
     1.8 +    if (!dst) {
     1.9 +        SDL_InvalidParamError("dst");
    1.10 +        return -1;
    1.11 +    }
    1.12 +    if (!dst_pitch) {
    1.13 +        SDL_InvalidParamError("dst_pitch");
    1.14 +        return -1;
    1.15 +    }
    1.16 +
    1.17      /* Fast path for same format copy */
    1.18      if (src_format == dst_format) {
    1.19          int bpp;