Fix SDL_BlitSurfaceScaled crash

SDL_BlitSurfaceScaled could crash when passed large coordinates, due
to final_dst.w or final_dst.h getting negative values.
This commit is contained in:
capehill
2025-06-29 16:34:05 +03:00
committed by Sam Lantinga
parent d04899fcfd
commit 1c5c3b1479
2 changed files with 45 additions and 1 deletions

View File

@@ -1256,7 +1256,7 @@ bool SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surfac
// Clip again
SDL_GetRectIntersection(clip_rect, &final_dst, &final_dst);
if (final_dst.w == 0 || final_dst.h == 0 ||
if (final_dst.w <= 0 || final_dst.h <= 0 ||
final_src.w < 0 || final_src.h < 0) {
// No-op.
return true;