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

Commit

Permalink
Fixed bug 984
Browse files Browse the repository at this point in the history
SDL_CreateTexture allows the creation of textures of size 0, which can lead to div by 0 errors
  • Loading branch information
slouken committed Apr 16, 2010
1 parent 2c6b80f commit c64c0ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -1649,6 +1649,10 @@ SDL_CreateTexture(Uint32 format, int access, int w, int h)
SDL_Unsupported();
return 0;
}
if (w <= 0 || h <= 0) {
SDL_SetError("Texture dimensions can't be 0");
return 0;
}
texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
if (!texture) {
SDL_OutOfMemory();
Expand Down

0 comments on commit c64c0ef

Please sign in to comment.