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

Please sign in to comment.