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

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