mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
surface: cannot set a palette to a non-indexed surface
This fixes a UBSAN warning later in this function where it calculates
(1 << SDL_BITSPERPIXEL(surface->format)). The bpp might be >= 32 and
out of range for a bit shift.
(cherry picked from commit d5af35e3fb)
This commit is contained in:
parent
b84e981ed8
commit
f00b0291b3
1 changed files with 1 additions and 1 deletions
|
|
@ -423,7 +423,7 @@ SDL_Palette *SDL_CreateSurfacePalette(SDL_Surface *surface)
|
|||
|
||||
bool SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
|
||||
{
|
||||
CHECK_PARAM(!SDL_SurfaceValid(surface)) {
|
||||
CHECK_PARAM(!SDL_SurfaceValid(surface) || !SDL_ISPIXELFORMAT_INDEXED(surface->format)) {
|
||||
return SDL_InvalidParamError("surface");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue