Commit f08b9a5b6bfd62741b6a1cd839ceee6a6e905828

Sylvain Becker 2020-12-29T16:02:52

SDL_BlitScaled: prevent crash if dest width or height is 0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c
index 44c61b0..36dd849 100644
--- a/src/video/SDL_stretch.c
+++ b/src/video/SDL_stretch.c
@@ -260,6 +260,10 @@ SDL_UpperSoftStretch(SDL_Surface * src, const SDL_Rect * srcrect,
         dstrect = &full_dst;
     }
 
+    if (dstrect->w == 0 || dstrect->h == 0) {
+        return 0;
+    }
+
     /* Lock the destination if it's in hardware */
     dst_locked = 0;
     if (SDL_MUSTLOCK(dst)) {