Fixed crash scaling very large surfaces

Fixes https://github.com/libsdl-org/SDL/issues/8878

(cherry picked from commit 09ba55b462)
This commit is contained in:
Sam Lantinga committed 2024-01-19 13:06:57 -08:00
1 parent 910e040e9e
commit f7ab765b84
4 files changed
+387 -386

No files matched your search

+5 -5
View File
@@ -54,9 +54,9 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
int srcy, srcx;
Uint32 posy, posx;
int incy, incx;
Uint64 srcy, srcx;
Uint64 posy, posx;
Uint64 incy, incx;
SDL_PixelFormat *src_fmt = info->src_fmt;
SDL_PixelFormat *dst_fmt = info->dst_fmt;
int srcbpp = src_fmt->BytesPerPixel;
@@ -69,8 +69,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
srcfmt_val = detect_format(src_fmt);
dstfmt_val = detect_format(dst_fmt);
incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w;
incy = ((Uint64)info->src_h << 16) / info->dst_h;
incx = ((Uint64)info->src_w << 16) / info->dst_w;
posy = incy / 2; /* start at the middle of pixel */
while (info->dst_h--) {