comparison src/video/SDL_video.c @ 4433:9fa97c6b0014

Fixed bug 984 SDL_CreateTexture allows the creation of textures of size 0, which can lead to div by 0 errors
author Sam Lantinga <slouken@libsdl.org>
date Thu, 15 Apr 2010 21:27:32 -0700
parents fb905d5674cc
children 791b3256fb22 d40bb3165d2b 37e9f8154ac4
comparison
equal deleted inserted replaced
4432:77ebcd41b577 4433:9fa97c6b0014
1647 } 1647 }
1648 if (!renderer->CreateTexture) { 1648 if (!renderer->CreateTexture) {
1649 SDL_Unsupported(); 1649 SDL_Unsupported();
1650 return 0; 1650 return 0;
1651 } 1651 }
1652 if (w <= 0 || h <= 0) {
1653 SDL_SetError("Texture dimensions can't be 0");
1654 return 0;
1655 }
1652 texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture)); 1656 texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
1653 if (!texture) { 1657 if (!texture) {
1654 SDL_OutOfMemory(); 1658 SDL_OutOfMemory();
1655 return 0; 1659 return 0;
1656 } 1660 }