# HG changeset patch # User Sam Lantinga # Date 1271392052 25200 # Node ID 9fa97c6b001484cd4baa2f4cf11d01ceefb3ee46 # Parent 77ebcd41b5773d4a64331ceca09972f178033fcb Fixed bug 984 SDL_CreateTexture allows the creation of textures of size 0, which can lead to div by 0 errors diff -r 77ebcd41b577 -r 9fa97c6b0014 src/video/SDL_video.c --- a/src/video/SDL_video.c Tue Apr 13 22:01:14 2010 -0700 +++ b/src/video/SDL_video.c Thu Apr 15 21:27:32 2010 -0700 @@ -1649,6 +1649,10 @@ 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();