Skip to content

Commit

Permalink
Fixed bug 4538 - validate image size when loading BMP files
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Jul 30, 2019
1 parent 3f90ab2 commit 31a87d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video/SDL_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ SDL_Surface * SDL_LoadBMP_RW (SDL_RWops *src, int freesrc)
(void) biYPelsPerMeter;
(void) biClrImportant;

if (biWidth <= 0 || biHeight == 0) {
SDL_SetError("BMP file with bad dimensions (%dx%d)", biWidth, biHeight);
was_error = SDL_TRUE;
goto done;
}
if (biHeight < 0) {
topDown = SDL_TRUE;
biHeight = -biHeight;
Expand Down

0 comments on commit 31a87d7

Please sign in to comment.