mirror of
https://github.com/yawut/SDL.git
synced 2026-09-30 20:26:42 -05:00
Fixed bug 984
SDL_CreateTexture allows the creation of textures of size 0, which can lead to div by 0 errors
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user