Always create a full 256-entry map in case color values are out of range
https://github.com/libsdl-org/SDL/commit/
8c91cf7dba5193f5ce12d06db1336515851c9ee9
Change-Id: I4aa9582fe207788a329778952c13414c7da88f92
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
#include "SDL_pixels_c.h"
#include "SDL_RLEaccel_c.h"
+#define SDL_CallocNumber 256
/* Lookup tables to expand partial bytes to the full 0..255 range */
}
*identical = 0;
}
- map = (Uint8 *) SDL_malloc(src->ncolors);
+ map = (Uint8 *) SDL_calloc(SDL_CallocNumber, sizeof(Uint8));
if (map == NULL) {
SDL_OutOfMemory();
return (NULL);
SDL_Palette *pal = src->palette;
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
- map = (Uint8 *) SDL_malloc(pal->ncolors * bpp);
+ map = (Uint8 *) SDL_calloc(SDL_CallocNumber, bpp);
if (map == NULL) {
SDL_OutOfMemory();
return (NULL);