Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Don't crash if we are asked to convert a surface to a NULl buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 25, 2013
1 parent cd758da commit a019815
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/video/SDL_surface.c
Expand Up @@ -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;
Expand Down

0 comments on commit a019815

Please sign in to comment.