From a019815d293005376a35b20fc00594f0b47f163d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 25 Feb 2013 00:54:25 -0800 Subject: [PATCH] Don't crash if we are asked to convert a surface to a NULl buffer. --- src/video/SDL_surface.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index c866f4753..710508ed3 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -935,6 +935,16 @@ int SDL_ConvertPixels(int width, int height, SDL_Rect rect; void *nonconst_src = (void *) src; + /* Check to make sure we are bliting somewhere, so we don't crash */ + if (!dst) { + SDL_InvalidParamError("dst"); + return -1; + } + if (!dst_pitch) { + SDL_InvalidParamError("dst_pitch"); + return -1; + } + /* Fast path for same format copy */ if (src_format == dst_format) { int bpp;