aboutsummaryrefslogblamecommitdiffstats
path: root/main/sdl_image/CVE-2019-13616.patch
blob: f2ed7c6aa078d77d94259a8604e9dd5c1222763c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                        
diff --git a/IMG_bmp.c b/IMG_bmp.c
index b3c7580..bfadd45 100644
--- a/IMG_bmp.c
+++ b/IMG_bmp.c
@@ -272,6 +272,11 @@ static SDL_Surface *LoadBMP_RW (SDL_RWops *src, int freesrc)
 		biClrUsed	= SDL_ReadLE32(src);
 		biClrImportant	= SDL_ReadLE32(src);
 	}
+	if (biWidth <= 0 || biHeight == 0) {
+		IMG_SetError("BMP file with bad dimensions (%dx%d)", biWidth, biHeight);
+		was_error = SDL_TRUE;
+		goto done;
+	}
 	if (biHeight < 0) {
 		topDown = SDL_TRUE;
 		biHeight = -biHeight;