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 3f90ab2 commit 31a87d75f15c7acd9470fab9ceb129c0a255871f
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/video/SDL_bmp.c
@@ -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;

0 comments on commit 31a87d7

Please sign in to comment.