Fixed bug 4538 - validate image size when loading BMP files SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Tue, 30 Jul 2019 21:30:24 +0300
branchSDL-1.2
changeset 12960ad1bbfbca760
parent 12914 87d60cae0273
child 12967 29968359729b
Fixed bug 4538 - validate image size when loading BMP files
src/video/SDL_bmp.c
     1.1 --- a/src/video/SDL_bmp.c	Tue Jun 18 23:31:40 2019 +0100
     1.2 +++ b/src/video/SDL_bmp.c	Tue Jul 30 21:30:24 2019 +0300
     1.3 @@ -143,6 +143,11 @@
     1.4  	(void) biYPelsPerMeter;
     1.5  	(void) biClrImportant;
     1.6  
     1.7 +	if (biWidth <= 0 || biHeight == 0) {
     1.8 +		SDL_SetError("BMP file with bad dimensions (%dx%d)", biWidth, biHeight);
     1.9 +		was_error = SDL_TRUE;
    1.10 +		goto done;
    1.11 +	}
    1.12  	if (biHeight < 0) {
    1.13  		topDown = SDL_TRUE;
    1.14  		biHeight = -biHeight;