SDL_BlitScaled: prevent crash if dest width or height is 0

This commit is contained in:
Sylvain Becker 2020-12-29 16:02:52 +01:00
parent 427c96ec11
commit f08b9a5b6b

View File

@ -260,6 +260,10 @@ SDL_UpperSoftStretch(SDL_Surface * src, const SDL_Rect * srcrect,
dstrect = &full_dst; dstrect = &full_dst;
} }
if (dstrect->w == 0 || dstrect->h == 0) {
return 0;
}
/* Lock the destination if it's in hardware */ /* Lock the destination if it's in hardware */
dst_locked = 0; dst_locked = 0;
if (SDL_MUSTLOCK(dst)) { if (SDL_MUSTLOCK(dst)) {