src/video/SDL_bmp.c
changeset 12612 07c39cbbeacf
parent 12503 806492103856
child 12644 7c643f1c1887
     1.1 --- a/src/video/SDL_bmp.c	Sun Feb 17 16:20:23 2019 +0100
     1.2 +++ b/src/video/SDL_bmp.c	Mon Feb 18 07:50:33 2019 -0800
     1.3 @@ -313,6 +313,10 @@
     1.4          SDL_assert(biBitCount <= 8);
     1.5          if (biClrUsed == 0) {
     1.6              biClrUsed = 1 << biBitCount;
     1.7 +		} else if (biClrUsed > (1 << biBitCount)) {
     1.8 +			SDL_SetError("BMP file has an invalid number of colors");
     1.9 +			was_error = SDL_TRUE;
    1.10 +			goto done;
    1.11          }
    1.12          if ((int) biClrUsed > palette->ncolors) {
    1.13              SDL_Color *colors;