Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fixed bug 4538 - validate image size when loading BMP files
- Loading branch information
Showing
with
5 additions
and
0 deletions.
-
+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; |
|
|