Blame SOURCES/SDL-1.2.15-CVE-2019-13616-validate_image_size_when_loading_BMP_files.patch

962229
changeset:   12960:ad1bbfbca760
962229
branch:      SDL-1.2
962229
parent:      12914:87d60cae0273
962229
user:        Ozkan Sezer <sezeroz@gmail.com>
962229
date:        Tue Jul 30 21:30:24 2019 +0300
962229
summary:     Fixed bug 4538 - validate image size when loading BMP files
962229
962229
diff -r 87d60cae0273 -r ad1bbfbca760 src/video/SDL_bmp.c
962229
--- a/src/video/SDL_bmp.c	Tue Jun 18 23:31:40 2019 +0100
962229
+++ b/src/video/SDL_bmp.c	Tue Jul 30 21:30:24 2019 +0300
962229
@@ -143,6 +143,11 @@
962229
 	(void) biYPelsPerMeter;
962229
 	(void) biClrImportant;
962229
 
962229
+	if (biWidth <= 0 || biHeight == 0) {
962229
+		SDL_SetError("BMP file with bad dimensions (%dx%d)", biWidth, biHeight);
962229
+		was_error = SDL_TRUE;
962229
+		goto done;
962229
+	}
962229
 	if (biHeight < 0) {
962229
 		topDown = SDL_TRUE;
962229
 		biHeight = -biHeight;
962229