diff -r 9ccaa3a0dfb6 -r a59bfe382008 IMG_bmp.c --- a/IMG_bmp.c Thu Jul 11 01:01:56 2019 +0300 +++ b/IMG_bmp.c Tue Jul 30 21:29:15 2019 +0300 @@ -272,6 +272,11 @@ biClrUsed = SDL_ReadLE32(src); biClrImportant = SDL_ReadLE32(src); } + if (biWidth <= 0 || biHeight == 0) { + IMG_SetError("BMP file with bad dimensions (%dx%d)", biWidth, biHeight); + was_error = SDL_TRUE; + goto done; + } if (biHeight < 0) { topDown = SDL_TRUE; biHeight = -biHeight;