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 authored and Sam Lantinga committed 2025-08-01 09:22:20 -07:00
1 parent d04899fcfd
commit 1c5c3b1479
2 files changed
+45 -1

No files matched your search

+1 -1
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;