Skip to content
Permalink
Browse files
Fixed bug 4538 - validate image size when loading BMP files
  • Loading branch information
sezero committed Jul 30, 2019
1 parent cdb178b commit e12c931e5bb260821ac7f11833eb627331779dcf
Showing with 5 additions and 0 deletions.
  1. +5 −0 IMG_bmp.c
@@ -272,6 +272,11 @@ static SDL_Surface *LoadBMP_RW (SDL_RWops *src, int freesrc)
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;

0 comments on commit e12c931

Please sign in to comment.