mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-10 21:38:14 +00:00
Make sure the surface used for a software renderer is a valid format
Fixes https://github.com/libsdl-org/SDL/issues/13323
This commit is contained in:
@@ -1125,6 +1125,11 @@ bool SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, S
|
|||||||
return SDL_InvalidParamError("surface");
|
return SDL_InvalidParamError("surface");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SDL_BITSPERPIXEL(surface->format) < 8 ||
|
||||||
|
SDL_BITSPERPIXEL(surface->format) > 32) {
|
||||||
|
return SDL_SetError("Unsupported surface format");
|
||||||
|
}
|
||||||
|
|
||||||
renderer->software = true;
|
renderer->software = true;
|
||||||
|
|
||||||
data = (SW_RenderData *)SDL_calloc(1, sizeof(*data));
|
data = (SW_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||||
|
Reference in New Issue
Block a user